回复 13# kensami727
调用 mshta 可能会被某些杀软拦截,也可以考虑 reg query 读取注册表:
http://bbs.bathome.net/thread-40744-1-1.html#pid186742
1.bat- @echo off
- for /f "tokens=1,3" %%i in ('reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UnitedVideo" /s') do (
- if "%%i" equ "DefaultSettings.XResolution" (
- set /a ScreenWidth=%%j
- ) else (
- if "%%i" equ "DefaultSettings.YResolution" (
- set /a ScreenHeight=%%j
- )
- )
- )
- echo ScreenWidth=%ScreenWidth%
- echo ScreenHeight=%ScreenHeight%
- pause
复制代码 2.bat- @echo off
- for /f "tokens=1-2" %%a in ('mshta VBScript:Execute("CreateObject(""Scripting.Filesystemobject"").GetStandardStream(1).Write(screen.width&"" ""&screen.height)"^)(close^)') do (
- set "ScreenWidth=%%a"
- set "ScreenHeight=%%b"
- )
- echo ScreenWidth=%ScreenWidth%
- echo ScreenHeight=%ScreenHeight%
- pause
复制代码
|