特别提醒:这个代码仅限于Windows XP 以上系统,Windows 2000都不支持(没有Wmic命令)
@echo off
for /f "delims=" %%i in ('Wmic DesktopMonitor Get ScreenHeight^,ScreenWidth /Value') do set "%%i">nul 2>nul
if not exist config.ini exit
for /f "delims=" %%i in ('findstr /i "Heigh= Width=" config.ini') do set "%%i">nul 2>nul
echo config配置模式 %Heigh%×%Width%
echo 当前显示模式 %ScreenHeight%×%ScreenWidth%
ping -n 3 127.1>nul 2>nul
if %ScreenHeight%%ScreenWidth% gtr 12801024 goto setting800600
if %ScreenHeight%%ScreenWidth% equ 800480 goto setting800600
findstr /i /c:"Heigh=%ScreenHeight%" config.ini||(findstr /i /v /c:"Heigh=" config.ini>config.x&&>>config.x echo Heigh=%ScreenHeight%&&move /y config.x config.ini)
findstr /i /c:"Width=%ScreenWidth%" config.ini||(findstr /i /v /c:"Width=" config.ini>config.x&&>>config.x echo Width=%ScreenWidth%&&move /y config.x config.ini)
exit
:setting800600
findstr /i /v /c:"Heigh=" config.ini>config.x&&>>config.x echo Heigh=800&&move /y config.x config.ini
findstr /i /v /c:"Width=" config.ini>config.x&&>>config.x echo Width=600&&move /y config.x config.ini