JSI Tip 9176. How can I report the console names and sizes configured on my computer?

In tip 0336 ยป Configure the Console via the registry, I described the registry entries associated with consoles.

Using REG.EXE, built into Windows XP, Windows Server 2003, and later, or installed from the Windows 2000 Support Tools on the CD-ROM, and the logical shift, and Boolean operators (bitwise and) in the SET command, I have scripted Consoles.bat to display the WindowSize and ScreenBufferSize of the configured consoles.

The syntax for using Consoles.bat is:


The report might look like:

WindowSize  Char Line   |  ScreenBufferSize  Char Line  |  Console Key
             100x050    |                     100x500   |  
             150x070    |                     150x350   |  %SystemRoot%_System32_CMD.exe
             120x060    |                     120x480   |  %SystemRoot%_System32_svchost.exe
             120x060    |                     120x960   |  Tips
             150x060    |                     150x300   |  Windows CD Compiler
NOTE: You can use PsExec.exe to run Consoles.bat remotely.

Consoles.bat contains:

@echo off
@echo.WindowSize  Char Line   ^|  ScreenBufferSize  Char Line  ^|  Console Key
set /a cnt=0
for /f "Tokens=*" %%c in ('reg query "HKCU\Console" /S^|FINDSTR /I "\Console WindowSize ScreenBufferSize"') do (
 set line=%%c
 if /i "!line:~0,1!" EQU "H" set ConKey= !line:~26!&set /a cnt=!cnt! +1
 if /i "!line:~0,1!" EQU "S" for /f "Tokens=3" %%i in ('@echo !line!') do set SBSz=%%i&set /a cnt=!cnt! +1
 if /i "!line:~0,1!" EQU "W" for /f "Tokens=3" %%i in ('@echo !line!') do set WinSz=%%i&set /a cnt=!cnt! +1
 if !cnt! EQU 3 (
  set /a cnt=0
  set /a "WinChar=WinSz&0xFFFF"
  set /a "WinLine=WinSz>>16"
  set /a "SBChar=SBSz&0xFFFF"
  set /a "SBLine=SBSz>>16"
  if !WinChar! LSS 100 set WinChar=0!WinChar!
  if !WinLine! LSS 100 set WinLine=0!WinLine!
  if !SBChar! LSS 100 set SBChar=0!SBChar!
  if !SBLine! LSS 100 set SBLine=0!SBLine!
  @echo              !WinChar!x!WinLine!    ^|                     !SBChar!x!SBLine!   ^| !Conkey!

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.