views:

25

answers:

1

I have successfully managed to hold a batch file until a process ends. But how do I hold a batch file until a process starts?

I am working using the following code:

@echo off

set process_1="calc.exe"
set process_2="mmc.exe"
set ignore_result=INFO:
set no_ignore=mmc.exe

:1
for /f "usebackq" %%M in (`tasklist /nh /fi "imagename eq %process_1%"`) do if not %%M==%ignore_result% goto 1
:2
for /f "usebackq" %%N in (`tasklist /nh /fi "imagename eq %process_2%"`) do if not %%N==%no_ignore% goto 2

echo Stuff finished.......

All I get when the program isn't running is "INFO: No tasks running with the specified criteria"

Thanks in advance

S

A: 
trismarck