解决Windows批处理无法设置窗口大小的问题

第一种方式:

1 @echo off
2 %~1 start "" conhost "%~f0" "::" & exit
3 mode con cols=68 lines=20

第二种方式:

:: 不需要管理员用这个
if "%1" neq "runas" mshta vbscript:CreateObject("Shell.Application").ShellExecute("conhost.exe","cmd.exe /c ""%~f0"" runas %*","","",1)(window.close)&&exit
shift && cd /d "%~dp0"
 
:: 需要管理员用这个
if "%1" neq "runas" mshta vbscript:CreateObject("Shell.Application").ShellExecute("conhost.exe","cmd.exe /c ""%~f0"" runas %*","","runas",1)(window.close)&&exit
shift && cd /d "%~dp0"

第三种方式:

pPq38JS

以上内容来自于:

http://www.bathome.net/redirect.php?goto=findpost&ptid=75661&pid=295096
http://www.bathome.net/redirect.php?goto=findpost&ptid=67299&pid=289686
http://www.bathome.net/redirect.php?goto=findpost&ptid=67299&pid=274607

特此感谢原作者!!!

posted @ 2026-01-22 14:10  狼王爷  阅读(34)  评论(0)    收藏  举报