I am trying to iterate over below loop , while executing if error occurs loop should go to IF condition and exit but loop never goes to IF condition always ELSE condition is executed , is there any problem with check of %errorlevel% ?
SET list=clean all cfg1
CD "C:\SW\CONS\build"
FOR %%a IN (%list%) DO (
CALL build.bat %%a
IF %errorlevel% neq 0 (
echo Exiting the loop
EXIT /B %errorlevel%
) ELSE (
echo Successfully executed "%%a"......
)
)