views:

175

answers:

2

How would I go about checking to see if a specific program is done running?

I'm attempting to make a script that runs a series of .exe's (specifically and setup program and a number of patches) in order automatically.

So far I've been able to get them to run at the same time, but that's obviously not what I need.

How can I get them to run each after the other is completed?

I've looked at a few already posted, but I wasn't able to modify them to what I need.

+1  A: 

Run your exe from the bat using this syntax

start /wait foo.exe

to wait for the executable to return before continuing on in the bat file.

sean e
A: 

Could you specify what method are you using for running the programs? There are more than one.

For instance, if you are using "START", there's a "/WAIT" switch which takes care of the waiting.

MrKishi
I'm currently using run, or just the filename on the line. I tried start, but it basically brought up command prompt with the directory where the .bat was run from.
Are you sure you are passing the right parameters to START?It should be used like this: START "Window Title" /WAIT "Path\to\my.exe" "my exe parameter" "or parameters"with an optional /Dpath to set the starting directory for you exe.
MrKishi
Eww, that was my first comment. Didn't realise I wouldn't get formatting, sorry. Important part: from START "Window Title" to \my.exe".
MrKishi
Ah, ok. I was unaware that I needed a window title. I'm also using Vista if that matters.
You do not need to specify a window title to use the start command. You should edit your original question and give more details about what you're trying to accomplish.
sean e
The wierd thing is though, it works fine when I have an extra parameter with a window title. When I take it away it stops working.
Which brings us back to my first comment: use the window title parameter and you're good. :)
MrKishi