Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
Credits 22 Posts 8 Joined 2007-04-21 04:11 19-year member UID 85925 Gender Male
Status Offline
I tried it, and directly using set errorlevel doesn't work
echo %errorlevel% // outputs 0
call :sub
echo %errorlevel% // outputs 1
if errorlevel 1 echo errorlevel=1 // the test here doesn't work
if errorlevel 0 echo errorlevel=0 // errorlevel is still 0, :(
pause
exit /b
:sub
set /a errorlevel=1
goto :EOF
[ Last edited by bright2k on 2007-4-24 at 03:44 PM ]