tags:

views:

1095

answers:

4

Say, if I have

  • foo.exe
  • bar.exe
  • baz.exe

How do I run all of them from a batch file asynchronously, i.e. without waiting for the previous program to stop?

+7  A: 

Using START command to run each program should get you what you need.

Every START invocation runs the command given in its parameter and returns immediately, unless executed with a /WAIT switch.

That applies to command-line apps. Apps without command line return immediately anyway, so to be sure, if you want to run all asynchronously, use START.

macbirdie
Okay, thanks. I should have read each entry of `help` carefully. :)
RichN
I actually had trouble with this the other day. I had to launch 30 explorer windows for a performance test. Didn't work and it wasn't important enough for me to look into it.. started browsing around instead in that window and several hours later when I closed it, another one poped up! And I was like what the hell, closed it.. another poped up! After 4-5 windows and a lot of what the **** I noticed the batchfile still running!
Jonas B
Shameless self-advertising: I once created a batch which is able to function as some kind of thread pool, just for processes: http://stackoverflow.com/questions/672719/parallel-execution-of-shell-processes/676667#676667
Joey
+4  A: 

Create a batch file with the following lines:

start foo.exe
start bar.exe
start baz.exe

The start command runs your command in a new window, so all 3 commands would run asynchronously.

Nikhil
+1  A: 

You can use the start command to spawn background processes without launching new windows:

start /b foo.exe

The new process will not be interruptable with CTRL-C; you can kill it only with CTRL-BREAK (or by closing the window, or via Task Manager.)

sproaticus
A: 

wow, that helped alot in starting "Teamspeak" and "TeamspeakNoise" parallel.

Pvt_Pirate