Tuesday, 15 July 2014

Windows batch: run a process in background and wait for it -



Windows batch: run a process in background and wait for it -

i need start 2 background processes batch job , wait them. unix shell analogue is:

myprocess1 -flags1 & pid1=$! myprocess2 -flags2 & pid2=$! wait ${pid1} wait ${pid2}

any ideas?

you solve it, using start wrapper.

the wrapper starts process start /wait , after process finished deletes file signaling.

the first process start through wrapper, sec can start start /wait. need wait file.

echo > waiting.tmp start cmd /c wrapper.bat myprocess1 -flags1 start /wait myprocess2 -flags2 :loop if exist waiting.tmp goto :loop

content of wrapper.bat

start /wait %* del waiting.tmp

windows batch-file windows-shell

No comments:

Post a Comment