Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Software Development
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry router security slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
Resize and move batch window?

Reply  
Thread Tools
NoNamed's Avatar
Junior Member with 17 posts.
 
Join Date: Dec 2009
29-Jan-2010, 04:49 PM #1
Resize and move batch window?
I'm making a quick chat in a batch file. For fun. I'm doing this by having one window that you type in, and another window that displays messages. It would be alot easier, if I could resize the windows, and move their position on the screen. So is this possible?
Squashman's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
29-Jan-2010, 06:52 PM #2
If you create a shortuct to launch the batch file you can make all those settings on the shortcut.
Ent's Avatar
Ent Ent is offline Ent is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 3,237 posts.
 
Join Date: Apr 2009
Location: United Kingdom
Experience: Intermediate
30-Jan-2010, 05:25 AM #3
If you right click the drag bar on the prompt window, you can choose either Properties or Default to change things like the size and colour. Properties of course does it immediately, while Default is permenant.
TheOutcaste's Avatar
Computer Specs
Distinguished Member with 9,048 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
03-Feb-2010, 08:52 PM #4
You can change the size using the Mode command
Mode Con Cols=xx Lines=xx
where Cols is width in characters, and Lines is height in lines

Changing the position requires creating a profile in the registry. Windows saves settings for Command Prompt windows based on the title, so if you open a window with a given title, you can control the properties for that window.

The following creates a profile in the registry, opens the first window, changes the position in that profile, then opens the 2nd window.
Commands are passed on the Start line to change the title and prompt of each window, and to change the color of the 2nd.
You can change the color in the registry, but may need to add a delay, as the registry may be updated before the first window has read the color values.
Code:
@Echo Off
:: This first title is used to store the registry setting
:: You can use it for the title of the First window, or change
:: The Title of both windows after opening
Set _Title=ChatPrompt
:: Set Height in lines, Width in characters. Buffer width is set
:: to the same value as the window width
Set _Height=10
Set _Width=60
Set _BHeight=500
Set _BWidth=%_Width%
:: Set position of the Top left corner in pixels
:: Position is relative to the Top left corner of the screen
Set _xPos=30
Set _yPos=20
:: Color values are the same as for the Color command
Set _Color=1E
:: Calculate hex values needed in the registry
Set /A _BufferSize=_BHeight*0x10000+_BWidth
Set /A _WindowPos=_yPos*0x10000+_xPos
Set /A _WindowSize=_Height*0x10000+_Width
:: This command will be passed to the Prompt to change the Title and Prompt
:: The ampersand must be escaped
Set _Cmd=Title Send^&Prompt $T$G
Call :_OpenCP %_BufferSize% %_Color% %_WindowPos% %_WindowSize% "%_Title%" "%_CMD%"
:: Increase the _yPos value so 2nd window is below the first.
:: 12 is the height in pixels for the font being used.
:: 40 is a value to allow for the height of the Title Bar. Adjust as needed
Set /A _yPos=_yPos+_Height*12+40
Set /A _WindowPos=_yPos*0x10000+_xPos
:: This command will be passed to the Prompt to change the Title, Prompt, and Color
Set _Cmd=Title Receive^&Prompt $G^&Color 0A
Call :_OpenCP %_BufferSize% %_Color% %_WindowPos% %_WindowSize% "%_Title%" "%_CMD%"
Goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Subroutines
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:_OpenCP
Reg Add "HKCU\Console\%~5" /V ScreenBufferSize /T REG_DWORD /D %1 /F
Reg Add "HKCU\Console\%~5" /V ScreenColors /T REG_DWORD /D 0x%2 /F
Reg Add "HKCU\Console\%~5" /V WindowPosition /T REG_DWORD /D %3 /F
Reg Add "HKCU\Console\%~5" /V WindowSize /T REG_DWORD /D %4 /F
Start "%~5" %COMSPEC% /K %6
__________________
Microsoft MVP - Windows Expert - Consumer
Of course I know all the answers ; I just don't always match the answers to the right questions

Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:25 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.