HKEY_CURRENT_USER\Console
is used to configure the console host (which in turn influences cmd.exe or PowerShell). AllowAltF4Close | |
CodePage | |
ColorTableN | Definition of 16 (N = 00…15) colors in the so-called color well |
CtrlKeyShortcutsDisabled | |
CursorSize | Percentage of character size occupied by the curser, possible values seem to be 25, 50 or 100 |
ExtendedEditKey | |
EnableColorSelection | |
FaceName | Name of an «alternate» font. The value __DefaultTTFont__ lets the system choose a font depending on the code page. |
FilterOnPaste | If some special characters should be replaced when pasting (for example MS Word smart quotes). Applicable in the improved version only. |
FontFamily | 0 = Raster Font, 48 = TrueType Font |
FontSize | Width + height*65536 |
FontWeight | 1 = Bold (GDI font weight?) |
ForceV2 | If the improved version of the Windows Console host should be used. |
FullScreen | 0 or 1 |
HistoryBufferSize | Number of commands that can be stored in each command history buffer. Compare with NumberOfHistoryBuffers and HistoryNoDup |
HistoryNoDup | Prevent or allow duplicates in history. Compare with HistoryBufferSize . |
InsertMode | 0 = Overtype mode; 1 = Insert mode. Compare with QuickEdit |
LineSelection | Applicable in the improved version only |
LineWrap | |
LoadConIme | 1 = Load conime.exe automatically when Windows 2000(?) starts. Only used when computer's locale is 932 (Japanese), 936 (Chinese), 949 (Korean Unified Hangul) or 950 (Chinese Big5 Extended) |
NumberOfHistoryBuffers | Default value is 4. Compare with HistoryBufferSize |
PopupColors | Color for popup window (for example when pressing F2 in cmd.exe ) background color followed by foreground color. Compare with ScreenColors |
QuickEdit | 1 enables quick edit which allows to use the mouse for cut&paste. |
ScreenBufferSize | columns + lines*65536 |
ScreenColors | Background color followed by foreground color. Compare with PopupColors |
ScrollScale | |
TrimLeadingZeros | |
VirtualTerminalLevel | The level of VT support provided by the Windows Console Host |
WindowAlpha | Opacity of the window (0x4d … 0xff) |
WindowPosition | Y + X*65536. If not set, use auto position |
WindowSize | width + height*65536 |
WordDelimiters | A list of characters that delimit words, for example .-/\=|,()[]{} |
%SystemRoot%_system32_cmd.exe
. <# # .\settings.ps1 '%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe' ` .\settings.ps1 (get-process -pid $pid).path ` -winW 200 -winH 70 ` -bufH 9999 ` -font 'Lucida Console' ` -fontH 12 #> param ( [parameter(mandatory=$true )] [String] $exePath, [parameter(mandatory=$false)] [Int16 ] $winH, [parameter(mandatory=$false)] [Int16 ] $winW, [parameter(mandatory=$false)] [Int16 ] $bufH, [parameter(mandatory=$false)] [String] $font, [parameter(mandatory=$false)] [Int16 ] $fontH, [parameter(mandatory=$false)] [Int16 ] $fontW ) set-strictMode -version 2 # # Registry key name is path of exe for which the # settings are stored. # However, registry keys don't allow backslashes. Thus, # they need to be replaced by underscores: # $regKey = 'HKCU:\Console\' + $exePath.replace('\', '_') write-verbose "regKey = $regKey" # # Create registry key. Do nothing if it already exists. # new-item $regKey -errorAction ignore if ( $psBoundParameters.ContainsKey('winH') -and $psBoundParameters.ContainsKey('winW') ) { write-verbose "Set Window size to: $winW x $winH" $null = set-itemProperty $regKey WindowSize (65536 * $winH + $winW) -force } if ( $psBoundParameters.ContainsKey('BufH') ) { if ( -not $psBoundParameters.ContainsKey('winW') ) { write-warning "winW is not specified" } else { # It rarely makes sense to have a buffer width that is different from the window width. $bufW = $winW write-verbose "Set buffer size to: $bufW x $bufH" $null = set-itemProperty $regKey ScreenBufferSize (65536 * $bufH + $bufW) -force } } if ( $psBoundParameters.ContainsKey('font') ) { switch ($font) { { $_ -in 'Consolas', 'Lucida Console' } { write-verbose "setting fontFamily to 54" $fontFamily = 54 # 0x36 # # It seems that fontWeight is necessary for fontFamily 54 # write-verbose "setting fontWeight to 400" $fontWeight = 400 $null = set-itemProperty $regKey FontWeight $fontWeight -force } 'Terminal' { write-verbose "setting fontFamily to 48" $fontFamily = 48 # 0x30 } Default { write-warning "Unknown font $font" return } } $null = set-itemProperty $regKey FontFamily $fontFamily -force $null = set-itemProperty $regKey FaceName $font -force } if ( $psBoundParameters.ContainsKey('fontH') ) { # # It seems that the width of the font is only required if $fontFamily is 48 # $null = set-itemProperty $regKey FontSize (65536 * $fontH + $fontW) -force }
@ @ rem QuickEdit @ rem -------- @ rem Setting it to 1 allows to copy text from the console @ rem by selecting it with the mouse and then pressing @ rem the enter key @ @ reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f
WindowSize
and ScreenBufferSize
. The former specifies for the actual displayed size on the screen while the latter controls the internally stored size of buffer. set /a
command. @set newWindowWidth=200 @set newWindowHeight=80 @set newScreenBufferWidth=%newWindowWidth% @set newScreenBufferHeight=9999 @set /a newWindowSize= (65536 * %newWindowHeight% + %newWindowWidth% ) @set /a newScreenBufferSize=(65536 * %newScreenBufferHeight% + %newScreenBufferWidth%) @echo newWindowSize = %newWindowSize% @echo newScreenBufferSize = %newScreenBufferSize% @reg add HKCU\Console /v WindowSize /t REG_DWORD /d %newWindowSize% /f @reg add HKCU\Console /v ScreenBufferSize /t REG_DWORD /d %newScreenBufferSize% /f
1
allows for colored output in a VBS Script. HKCU\console
can also be stored in the NT_CONSOLE_PROPS
. HKEY_CURRENT_USER\Software\Microsoft\Command Processor
.