@echo off
:::::::::::::: Lets set some variables ::::::::::::::
set email=tim@blat.tld
set server=-server localhost
set subject=-s "Test Blat ERRORLEVEL's"
set tof=-to %email% -f %email%
set msg=%0
::::::::::::::::: Now we run Blat! :::::::::::::::::
blat %msg% %tof% %subject% %server%
::::::::::: A quick message to the screen :::::::::::
echo.
echo ErrorLevel returned from Blat == %ERRORLEVEL%
echo.
:: Check each errorlevel from 0 through 14 in that order
set ELmsg=Blat returned this ERRORLEVEL
::::::::::::::: Here is the FOR loop! :::::::::::::::
FOR /L %%i IN (0,1,14) DO if ERRORLEVEL %%i echo %ELmsg% %%i
|