How do I make a .bat (batch-file) cmd window move its self and resize to 200x200. I know that can be done to a hta file but can it be done to a .bat too. I have looked on Google but I have found nothing of any use.
Asked
Active
Viewed 745 times
0
-
@David Heffernan The batch window (cmd) – 09stephenb Mar 19 '14 at 10:32
-
possible duplicate of [Resize command prompt through commands](http://stackoverflow.com/questions/8688846/resize-command-prompt-through-commands) – David Heffernan Mar 19 '14 at 10:39
1 Answers
1
Use this:
mode con: cols=200 lines=200
Example of Moving window. You basically have to write a registry key then create a new window with the key name you just added. Then cleanup the script and reg key.
@echo off
setlocal
set "Server1=127.0.0.1"
call :PosWindows 50 50 %server1% "%server1%"
reg delete "hkcu\console\%server1%" /f>nul
exit /b
:PosWindows xpos ypos serverip title
set /a "pos=(%2 << 16) + %1"
>nul reg add "hkcu\console\%~4" /v WindowPosition /t REG_DWORD /d "%pos%" /f
>%3.cmd echo.@echo off
>>%3.cmd echo mode con: cols=200 lines=200
>>%3.cmd echo.ping %3
start "%~4" cmd /k "%3.cmd"
ping -n 1 -w 4000 127.0.0.1>nul
if exist "%~3.cmd" del /q "%~3.cmd"
exit /b

Matt Williamson
- 6,947
- 1
- 23
- 36
-
-
That's a bit harder to do. You have to modify the registry to do it. I have a script for that somewhere. let me find it. – Matt Williamson Mar 19 '14 at 10:53
-
Is this for a new window or your default CMD window? I'll post an example so you will understand why I'm asking. – Matt Williamson Mar 19 '14 at 11:33