I am using the below script to abort the batch process on error in maxl log.
line1- findstr /m "ERROR" D:\PLANNING_LOAD\PLAN.log >> %Log%
line2- if %errorlevel%==0 >> %Log%
Batch process is terminating at line 2 even though there is no error in PLAN.log. I used echo to check the value of ERRORLEVEL, its is showing 0 at the start of the process and changing to 1 after line2 . Please let me know as I am confused as to how this works. Thanks!
No matter what errorlevel it is always going to exit. You'll have to write a goto statement and then use exit there.
IF not errorlevel 1 GOTO PlanningLoad Error
':PlanningLoadError (remove the ' it was converting colon and P to a smiley)
echo Error in Planning load >>%Log%