I have a batch file that runs a richcopy program, I am wanting to monitor the errorlevel so far i have got this
IF (%ERRORLEVEL% == 0) goto OK
else IF (%ERRORLEVEL% == 3010) goto Report
:Report
:OK
END
What I am wanting to do is to report the error to the event viewer so that it can be monitored via another application that monitors the event logs.
You can use
EVENTCREATEto write to the event log.An example would be:
More information can be found at the TechNet article.
EDIT
In your case, try this. Your parenthesis and use of == may be throwing things off.
This way, if the error level isn’t 3010, it always skips to the OK method, in case you get something other than 0 or 3010.