You can use EVENTCREATE to write to the event log.
Example:
EVENTCREATE /T ERROR /L APPLICATION /ID 100 /D "This is your error message."
More information can be found in the TechNet article .
EDIT
In your case, try this. Your bracket and using == can throw things away.
@ECHO OFF IF %ERRORLEVEL% NEQ 3010 goto OK EVENTCREATE /T ERROR /L APPLICATION /ID 100 /D "This is your error message." :OK EXIT
Thus, if the error level is not equal to 3010, it always skips the OK method if you get something other than 0 or 3010.
LittleBobbyTables
source share