batch file - how to bring back value of the variable that was set in child cmd prompt? -
in example result rest of script doesn't see variable changed.
set testvar=initial_value start "" /b /belownormal /wait cmd /c set testvar=im'changed echo %testvar%
is there way bring it's value main command prompt ? (this simplified example of app must run in lower cpu priority, , need receive it's errorlevel value using &&
this:
start "" /b /belownormal /wait cmd /c myapp.exe && set elevel=ok || set elevel=fail
try this:
@echo off &setlocal set testvar=initial_value /f "delims=" %%a in ('start "" /b /belownormal /wait cmd /c echo(im^'changed') set "testvar=%%a" echo %testvar%
.. or errorlevel
:
@echo off &setlocal start "" /b /belownormal /wait cmd /c exit /b 322 echo %errorlevel%
Comments
Post a Comment