I have a .bat file which runs four python files. I need to have some error handling in this .bat file. Basically if any thing goes wrong I want to stop the process.
--Want to stop the process when any of that python script fails. --Want to run as normal when none of the python fails.
python "C:\EarthSQL-Testing\mckayplod.py" "C:\EarthSQL-Testing"
IF %ERRORLEVEL% EQ 0 GOTO :Next
IF %ERRORLEVEL% NEQ 0 ECHO PYTHON ERROR HAS FOUND ->Error.txt
Copy "C:\EarthSQL-Testing\Error.txt" "C:\Users\EarthSQL\EarthSQL\Documents - Documents\ErrorLog\" /y
PAUSE
:Next
python "C:\EarthSQL-Testing\mckaypersonnel.py" "C:\EarthSQL-Testing"
IF %ERRORLEVEL% EQ 0 GOTO :Next
IF %ERRORLEVEL% NEQ 0 ECHO PYTHON ERROR HAS FOUND ->Error.txt
Copy "C:\EarthSQL-Testing\Error.txt" "C:\Users\EarthSQL\EarthSQL\Documents - Documents\ErrorLog\" /y
PAUSE
:Next
python "C:\EarthSQL-Testing\mckaydrilling.py" "C:\EarthSQL-Testing"
IF %ERRORLEVEL% EQ 0 GOTO :Next
IF %ERRORLEVEL% NEQ 0 ECHO PYTHON ERROR HAS FOUND ->Error.txt
Copy "C:\EarthSQL-Testing\Error.txt" "C:\Users\EarthSQL\EarthSQL\Documents - Documents\ErrorLog\" /y
PAUSE
:Next
python "C:\EarthSQL-Testing\mckactivities.py" "C:\EarthSQL-Testing"
IF %ERRORLEVEL% EQ 0 GOTO :Next
IF %ERRORLEVEL% NEQ 0 ECHO PYTHON ERROR HAS FOUND ->Error.txt
Copy "C:\EarthSQL-Testing\Error.txt" "C:\Users\EarthSQL\EarthSQL\Documents - Documents\ErrorLog\" /y
PAUSE
Currently the above script, it is running only first python file and then it doesn't run the 2nd python file and onwards files. Any help what is wrong in my batch file ????