I am trying to create a batch script which runs 2 python scripts in parallel and return an errorcode if in either one (or both) of the scripts is an error. In case both script have run correctly the next python script should be ran.
When I use the script below the processes are ran in parallel but the !errorlevel! is always 0, even if there is an error in both of the scripts.
In case I run only one of the python scripts with the start /wait command or if I run the 2 scripts sequentially using && instead of |, the !errorlevel! is returned correctly.
How can these scripts be run in parallel while still output the correct errorlevel?
setlocal enableDelayedExpansion
start /wait python apirequest_0001.py | start /wait python apirequest_0002.py
echo !errorlevel!
if !errorlevel! neq 0 (goto end )
start /wait python join_data.py
ErrorLevelvalue of the "parallelly" running Python script, because you used a pipe, which initiates a newcmd.exeinstance for either side (since you are using the internal commandstart), so as soon as that command line is done, these instances are destroyed. Why are you usingstartafter all?