#133676 - 2005-02-12 12:09 AM
Re: setting size of cmd.exe buffer
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4567
Loc: USA
|
I tested this with XP, and it worked... I'm assuming the value of "ScreenBufferSize"= HexValueHeight + 00 + HexValueWidth. I found no documentation on this, so this may only be consistent with XP. Try it and see.
Code:
break on
$previousbuffer=SetCMDBuffersizeHeight()
SetCMDBuffersizeHeight(80)
$currentbuffer=SetCMDBuffersizeHeight()
? "Buffer changed from " + $previousbuffer + " to " + $currentbuffer +"."
? "Open a new CMD Window to see changes."
function SetCMDBufferSizeHeight(optional $lines)
dim $console,$SBSValue,$SBSHeight,$SBSWidth,$index
$Console="HKCU\Console"
$SBSValue="ScreenBufferSize"
$SBS=dectohex(readvalue($Console,$SBSValue))
$index=instrrev($SBS,"00")
$SBSWidth=substr($SBS,$index+2)
$SBSHeight=substr($SBS,1,$index-1)
if $lines=""
$SetCMDBufferSizeHeight=hextodec($SBSHeight)
else
if vartype($lines)=3
$=writevalue($Console,$SBSValue,"" + hextodec(dectohex($lines) + "00" + $SBSWidth),"Reg_DWORD")
else
exit -1
endif
endif
endfunction
Function HextoDec($s)
While $s
$HextoDec=16.0*$HextoDec+Execute("Exit &"+Left($s,1))
$s=SubStr($s,2)
Loop
EndFunction
|
|
Top
|
|
|
|
#133678 - 2005-02-15 04:02 AM
Re: setting size of cmd.exe buffer
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11629
Loc: CA
|
I tried it and it worked fine for me Al.
If you're bored you could add support for a couple of the other items too
|
|
Top
|
|
|
|
#133679 - 2005-02-15 04:55 AM
Re: setting size of cmd.exe buffer
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4567
Loc: USA
|
Are you refering to the Width? If so, I couldn't think of a single time I have ever changed that setting...
|
|
Top
|
|
|
|
#133681 - 2005-02-15 09:25 AM
Re: setting size of cmd.exe buffer
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Quote:
LOL I've never needed to set this stuff with a script either, but I do setup all my DOS Consoles with a LOT of buffer and other settings. Comes in very handy when running DOS type programs and other command line utils.
Me too.
I have a "runas" shortcut on the desktop which I use to start CMD sessions as a domain administrator in various domains.
To ensure that I don't make any stupid mistakes and type the wrong thing in the wrong securiy context, I colour the background depending on which domain I'm logged in to.
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 2924 anonymous users online.
|
|
|