This is the code of my bat file which I call from my first SQL job step.
@echo off
REM %year% %month% calculation
.....
start LongWork.exe %year% %month%
Second SQL job step calls a SecondLongWork.exe which uses the results of the LongWork.exe. The problem is that the second step runs immediately after .bat ends its work. It does not wait while LongWork.exe end its work. How can I change this behavior?
I could reproduce such a problem at the command prompt: using start
will open a new cmd window, and the original one has a new prompt (doesn't wait till the started app returns), while without start
the prompt is hanging and waiting for the app to return. So what is the reason for using start
? In that case your .bat file is proceeding to the next statement or if there's no more returns right after the app starts.