CMD window properties

  • Thread starter Thread starter John Martin
  • Start date Start date
J

John Martin

I'm looking for a way to change the CMD window properties of the screen
buffer size height and width via a script (and save properties for future
windows with the same title).

thanx,
john
 
Your script needs to set the values in this key;
HKEY_CURRENT_USER\Console

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| I'm looking for a way to change the CMD window properties of the screen
| buffer size height and width via a script (and save properties for future
| windows with the same title).
|
| thanx,
| john
|
|
 
Your script needs to set the values in this key;
HKEY_CURRENT_USER\Console

Maybe I'm missing something, but I didn't understand how the Hex
values worked for ScreenBufferSize and WindowSize.

Sure, we could set what we wanted in one prompt then query, and record
the value for future scripts, but how does one calculate the values to
put in those registry settings?

Clay Calvert
(e-mail address removed)
Replace "W" with "L"
 
Divide it into two 16 bit numbers. One is height and one is width. Use Calc to converrt.
EG
012c0050

is
012c x 0050 hex
300 x 80 decimal
 
I didn't know that. Thanks Dave.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
Divide it into two 16 bit numbers. One is height and one is width. Use Calc
to converrt.
EG
012c0050

is
012c x 0050 hex
300 x 80 decimal
 
Clay said:
Maybe I'm missing something, but I didn't understand how the Hex
values worked for ScreenBufferSize and WindowSize.

Sure, we could set what we wanted in one prompt then query, and record
the value for future scripts, but how does one calculate the values to
put in those registry settings?

Hello Clay and John,
you might find the following batch useful, returning this on my w2k:
==screen=copy==========================================================
C:\test>ConsoleSizes.cmd
Window_X*Y_|_Buffer_X*Y_|_App-key_____________________________
80*25 | 80*300 | HKCU\console
80*50 | 0*0 | HKCU\console\%SystemRoot%_system32_cmd.exe
120*60 | 120*60 | HKCU\console\cmd.exe
80*25 | 80*300 | HKCU\console\Far.exe
80*25 | 80*300 | HKCU\console\Settime from Mars
==screen=copy==========================================================

Where the last entry is the name of a shortcut on my desktop, so these
values are stored in sub keys of HKCU\Console (may be in parallel to the
..lnk file)

::ConsoleSizes.cmd::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
setlocal
echo Window_X*Y_^|_Buffer_X*Y_^|_App-key_____________________________
for /F "tokens=1-2,*" %%A in (
'reg query hkcu\console /s^|findstr "\ ScreenBufferS WindowS"') do (
if "%%B" NEQ "REG_DWORD" (set "HKCUCon=%%A %%B %%C"&set "SBS="&SET "WS=")
if "%%A" EQU "ScreenBufferSize" set "SBS=%%C"
if "%%A" EQU "WindowSize" set "WS=%%C" & call :display)
goto :eof
:display
set /A "WSW=WS&0xffff, WSH=WS>>16"
set "WSW= %WSW%"&set "WSH=%WSH% "
set /A "SBW=SBS&0xffff, SBH=SBS>>16"
set "SBW= %SBW%"&set "SBH=%SBH% "
set "HKCUCon=%HKCUCon:HKEY_CURRENT_USER=HKCU%"
echo/%WSW:~-5%*%WSH:~,5%^|%SBW:~-5%*%SBH:~,5% ^| %HKCUCon%
::ConsoleSizes.cmd::::::::::::::::::::::::::::::::::::::::::::::::::::

HTH
 
On Wed, 4 Aug 2004 15:13:48 +0200, "Matthias Tacke"

Thank you very much.
::ConsoleSizes.cmd::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
setlocal
echo Window_X*Y_^|_Buffer_X*Y_^|_App-key_____________________________
for /F "tokens=1-2,*" %%A in (
'reg query hkcu\console /s^|findstr "\ ScreenBufferS WindowS"') do (
if "%%B" NEQ "REG_DWORD" (set "HKCUCon=%%A %%B %%C"&set "SBS="&SET "WS=")
if "%%A" EQU "ScreenBufferSize" set "SBS=%%C"
if "%%A" EQU "WindowSize" set "WS=%%C" & call :display)
goto :eof
:display
set /A "WSW=WS&0xffff, WSH=WS>>16"
set "WSW= %WSW%"&set "WSH=%WSH% "
set /A "SBW=SBS&0xffff, SBH=SBS>>16"
set "SBW= %SBW%"&set "SBH=%SBH% "
set "HKCUCon=%HKCUCon:HKEY_CURRENT_USER=HKCU%"
echo/%WSW:~-5%*%WSH:~,5%^|%SBW:~-5%*%SBH:~,5% ^| %HKCUCon%
::ConsoleSizes.cmd::::::::::::::::::::::::::::::::::::::::::::::::::::

Clay Calvert
(e-mail address removed)
Replace "W" with "L"
 
Back
Top