Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

WMIC in Batch File

$
0
0

Can anyone tell me what is wrong with this script?  I have used this exact script with other WMIC commands and it works fine.  The WMIC commands also work fine outside of the script.

FOR /F "tokens=*" %%A in ('wmic DESKTOPMONITOR get ScreenHeight') do SET MyScreenHeight=%%A

FOR /F "tokens=*" %%B in ('wmic DESKTOPMONITOR get ScreenWidth') do SET MyScreenWidth=%%B



REM Removes spaces including trailing spaces from variables

set MyScreenHeight=%MyScreenHeight: =%

set MyScreenWidth=%MyScreenWidth: =%



echo.

echo Your resolution is %MyScreenWidth% x %MyScreenHeight%

pause

Chad L. Hutson
Owner, CPU Vet
www.cpuvet.com

Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>