Cannot set a variable in a batch file -
i have following...
@echo off setlocal enabledelayedexpansion /f "skip=1" %%p in ('wmic cpu loadpercentage') @echo %%p echo ...this worked echo. pause /f "skip=1" %%p in ('wmic cpu loadpercentage') set cpu=%%p echo cpu %cpu% echo ...this did not work echo. pause
how come can't set number in variable %cpu% it's blank!
for /f "skip=1" %%p in ('wmic cpu loadpercentage') set cpu=%%p & goto :end_for :end_for
wmic
produces empty line @ end.you can try /format:csv
@ end of wmic call prevent that.
check this: http://www.dostips.com/forum/viewtopic.php?f=3&t=4266
Comments
Post a Comment