Tech Support banner

Status
Not open for further replies.
1 - 8 of 8 Posts

·
Registered
Joined
·
85 Posts
Discussion Starter · #1 ·
I'm trying to create a .bat file that will execute 4 programs at once. The problem is one of the programs needs to wait until the other 3 have finished loading before it loads or it will return an error message.

This is the comman sequence I'm using (in WinXP SP2 system)

start "" "c:\Program Files\Program 1.exe"
start "" "c:\Program Files\Program 2.exe"
start "" "c:\Program Files\Program 3.exe"
start "" "C:\Program Files\Program 4.exe"

Program "4" needs to wait until the first 3 are finished executing before it can load. How can I get it to do that? Any help would be appreciated.

~P.J.F.
 

·
Registered
Joined
·
1,097 Posts
If the programs were closing, you could just use the /WAIT switch, however, I don't think there is a batch function that will do what you want. You can install the SLEEP program that comes with the Windows 2003 Server Resource Kit (yes, it works with XP), or install a third-party batch program that will allow you to set a time interval before the fourth program starts.
 

·
Superhuman Computer
Joined
·
1,632 Posts
Additionally, you could put the line "pause" in between prog 3 and 4 - the batch file will then wait for you to press something on the keyboard before running the fourth. It's not perfect, but it'll work if you simply wait for progs 1-3 to start, then hit any key in the batch window to start the fourth.
 

·
Registered
Joined
·
85 Posts
Discussion Starter · #4 · (Edited)
Thanks guys...

RK, your suggestion is close enough to what I need. Too bad you can't just enter a number after "pause" to tell it how long to wait. Seems like such a simple thing...By the way, the same sequence of 4 progs executed flawlessly on my Win98 machine. Funny.
Anyway, I'll use the "pause" entry until I can figure a way around it. Thanks again.

~P.J.Farrauto

On a similar note - now that I think of it...is there a way to create a .bat that would CLOSE all 4 progs when I'm done with them...? (Obviously I'm into clicking as little as possible.)
 

·
Superhuman Computer
Joined
·
1,632 Posts
I've just had an idea which may help you out. Download AutoIt V3 - this has functionality which can open a program, wait for a certain text string in it's title bar, then do something else. This may work if the programs you need loading first change their titles when finally loaded..... even if they don't it may well work.

Just so you know, the thing you're looking for to wait for the active task to be called something is WinWaitActive() in AutoIt.

It's quite simple to use, once you get the hang of it, and you can use it for automating all sorts of things in windows.
 

·
Registered
Joined
·
85 Posts
Discussion Starter · #7 · (Edited)
Thanks RK~

I looked it up. Sounds cool as hell (I'm a BIG tweak-geek, so stuff like that appeals to me). I'll check it out! I appreciate you giving it some thought. Do you know a lot about it?

~PJF
 

·
Superhuman Computer
Joined
·
1,632 Posts
Not much, I've never really had the time to learn much more than the basics, however it's really helped me at work - some things I do are very boring, repetetive, long and most importantly, require a lot of clicks but very few decisions. I can set an AutoIt script running on one system, start it on another, get a third going, head off for a cup of coffee, and by the time I've got back I'm just in time to watch the three finish. Takes a fraction of the time to do (definately takes less than a quarter of the time I would normally have to spend running these jobs) plus I get a coffee break too :grin:

Now I've got all this extra time I should really learn more about what it can do.....
 
1 - 8 of 8 Posts
Status
Not open for further replies.
Top