Checking ErrorLevels returned from Blat

Here's an example of how you could capture the return codes from Blat. Important things to note is that error level checking is done beginning with the highest number, then going down to the lowest number. A zero means no error. Any additional commands to be executed if Blat runs successfully should follow the :NOERROR label. If an error does occur, the batch file will display an error message and then stop, waiting for the operator to press a key for it to then continue. If Blat runs with no errors (error level zero) then the batch file exits without any messages and without stopping.
:: Sample batch file for Blat
@ECHO OFF
blat (...rest of command line goes here)
IF ERRORLEVEL=13 THEN GOTO :ERROR13
IF ERRORLEVEL=12 THEN GOTO :ERROR12
IF ERRORLEVEL=5  THEN GOTO :ERROR5
IF ERRORLEVEL=4  THEN GOTO :ERROR4
IF ERRORLEVEL=3  THEN GOTO :ERROR3
IF ERRORLEVEL=2  THEN GOTO :ERROR2
IF ERRORLEVEL=1  THEN GOTO :ERROR1
:: If we get this far, then there was no error code
GOTO :NOERROR

:ERROR13
ECHO ERROR: Error opening temporary file in temp directory!
GOTO :EXIT

:ERROR12
ECHO ERROR: -server or -f options not specified or not found in registry
GOTO :EXIT

:ERROR5
ECHO ERROR: Error reading file/message text
GOTO :EXIT

:ERROR4
ECHO ERROR: Problem with the file/message text
GOTO :EXIT

:ERROR3
ECHO ERROR: Error reading file/message text or attached file
GOTO :EXIT

:ERROR2
ECHO ERROR: Error Level 2 returned
GOTO :EXIT

:ERROR1
ECHO ERROR: Error Level 1 returned
GOTO :EXIT

:NOERROR
:: Any additional batch processing goes here
GOTO :EXITNOPAUSE

:EXIT
PAUSE
:EXITNOPAUSE
:: End of batch file here
See the Batch file notes... for a bit more info
blat_return_codes.htm by toby_korn