H
homerlex
I have a batch file that executes a bunch of apps and counts the
errors. The issue is that I can't see the current error count from
within the for loop.
I've stripped down the batch file to the following. When I run it the
ERROR_COUNT is shown properly at the end but always shows as zero in
the for loop. What am I doing wrong?
I have similar issue testing %errorlevel% from within the loop (though
this is not shown in the sample below)
@Echo Off
SET EXECUTION_LIST=1.exe 2.exe 3.exe 4.exe
SET ERROR_COUNT=0
FOR %%d in (%EXECUTION_LIST%) do (
echo ****************************************
echo Running: %%d
echo ----------------------------------------
rem %%d
SET /A ERROR_COUNT+=1
echo %ERROR_COUNT%
echo ----------------------------------------
echo ****************************************
)
echo Errors: %ERROR_COUNT%
errors. The issue is that I can't see the current error count from
within the for loop.
I've stripped down the batch file to the following. When I run it the
ERROR_COUNT is shown properly at the end but always shows as zero in
the for loop. What am I doing wrong?
I have similar issue testing %errorlevel% from within the loop (though
this is not shown in the sample below)
@Echo Off
SET EXECUTION_LIST=1.exe 2.exe 3.exe 4.exe
SET ERROR_COUNT=0
FOR %%d in (%EXECUTION_LIST%) do (
echo ****************************************
echo Running: %%d
echo ----------------------------------------
rem %%d
SET /A ERROR_COUNT+=1
echo %ERROR_COUNT%
echo ----------------------------------------
echo ****************************************
)
echo Errors: %ERROR_COUNT%