I'm trying to write a batch job that executes via task scheduler. The objective is to run these exe jobs sequentially. However, some of these jobs have dependencies on others. for eg.
- job1.exe (no dependencies. exe for an API call)
- job2.exe (no dependencies. exe for an API call)
- job3.exe (python file in exe, requires job1 to run successfully, waiting 3 mins before executing)
- job4.exe (python file in exe, requires both job2 and job1 to run successfully waiting 3 mins before executing)
Aim : to run job1 and job2 in parallel job3 and job4 whenever possible currently it's set up like this:
START /min "" "%~dp0\ job1.exe
IF %ErrorLevel% EQU 0 (
TIMEOUT /t 180
START /min "" "%~dp0\job3.exe)
)ELSE (
ECHO job3 did not run because job1 failed
TIMEOUT /t 180
START /min "" "%~dp0\ job2.exe
IF %ErrorLevel% EQU 0 (
START /min "" "%~dp0\job4.exe)
)ELSE (
ECHO job4 did not run because job2 failed
TIMEOUT /t 180
Currently, the jobs don't work.