0

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.

09stephenb
  • 9,358
  • 15
  • 53
  • 91

1 Answers1

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