Originally posted by lwb1978 at 2007-7-9 18:48:
re ccwan
因为我的电脑会取到两个分辨率的值,一个是实际的,下边一个是空的,所以在for过后,最终%screenwidth% %screenheight%得到的是空值,所以我测试 ...
不用两次读取:
@echo off
setlocal EnableDelayedExpansion
echo 当前分辨率为:
for /f %%i in ('"wmic desktopmonitor get screenwidth,screenheight /value"') do (
set %%i>nul
if not "!screenwidth!" == "" set 屏幕宽=!screenwidth!&&set 屏幕高=!screenheight!
)
echo %屏幕宽% %屏幕高%
pause>nul