HuyPV
Tuesday, December 4, 2012
setlocal EnableDelayedExpansion
REM declare array
set URL_LIST=(http://192.168.17.102/ http://192.168.17.103/ http://192.168.17.104/ http://192.168.17.105/)
for %%i in %URL_LIST% do (
curl --connect-timeout 2 -kI %%i > NUL 2>&1
REM !errorlevel! instead of %errorlevel%
echo Return exit code !errorlevel!
if errorlevel 1 (
echoj [alert] %%i
) else (
echoj [---ok] %%i
)
)
Title:
Batch script exit code in for loop
Description:
setlocal EnableDelayedExpansion REM declare array set URL_LIST=(http://192.168.17.102/ http://192.168.17.103/ http://192.168.17.104/ http...
...
Rating:
4