本帖最后由 小程936 于 2016-6-17 23:31 编辑
- @echo off&set xn=xn.ini
- IF not EXIST %xn% echo 错误:找不到文件%xn%&pause>nul&exit
- for /f "delims=" %%i in ('wmic DesktopMonitor get ScreenWidth^,ScreenHeight /value ^| findstr "="') do set "%%i"
- for /f "delims=" %%z in (%xn%) do (set az=%%z)&call :小程936
- (del %xn%)&ren %xn%.1 %xn%
- start "" "%~dp0xm.exe"
- exit
- :小程936
- for /f "tokens=1 delims==" %%a in ("%az%") do (set aa=%%a)
- >>%xn%.1 (if "%aa%" == "ScreenWidth" (echo+ScreenWidth=%ScreenWidth%)&goto :eof
- if "%aa%" == "ScreenHeight" (echo+ScreenHeight=%ScreenHeight%)&goto :eof
- (echo+%az%)&goto :eof)
复制代码 自动检测xn.ini是否存在,若不存在报错并退出
自动分析xn.ini文件并修改文件内容
该版本相对上一版本便于理解且更稳定 |