Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to create a very simple Windows-XP batch file:

Program1.exe
Sleep 3
Program2.exe
Sleep 5
Program3.exe
Sleep 11

Of course, I don't want to have to exit each program, before the next one starts. The default for batch files seems to be "stop until the previous program exists".

The three executables listed above are program like Notepad: They open and run and don't just "open, run, close".

How do I get this script to run as expected?

share|improve this question
add comment

3 Answers

Use the Start command. Change your batch to this:

Start Program1.exe
Sleep 3
Start Program2.exe
Sleep 5
Start Program3.exe
Sleep 11
share|improve this answer
2  
All that START did was to continue opening more and more DOS windows... and never running any of my .exe programs at all. –  Sandy Dec 26 '10 at 20:08
    
I find that odd. Looking at your edit, are these GUI type programs that don't have a console? If you run notepad.exe from the Console, it will not block the console from continuing. –  vcsjones Dec 26 '10 at 21:04
2  
@Sandy: sounds like there is a line break between "Start" and the program name?! or maybe you have " " around the program name? if so, remove them –  Felix Dombek Dec 27 '10 at 2:50
    
Having the same problem and removing the quotes doesn't make it work either. –  Chris Charabaruk Dec 28 '10 at 19:13
    
do these apps open? is it perhaps a path issue? –  datatoo Dec 30 '10 at 13:09
show 1 more comment

Another suggestion: If you are putting your program in quotes because there are spaces in the path to the exe, you need to do this:

start "" "C:\myPath\myApp.exe"

Found it here: Run Windows application from Command Prompt

share|improve this answer
add comment

Try using JScript instead. Create a file called run_programs.js that looks something like this:

var objShell = new ActiveXObject("WScript.Shell");

objShell.run( "Program1.exe",  1, false);
objShell.run( "Program2.exe",  1, false);
objShell.run( "Program3.exe",  1, false);

Then change your batch file to simply execute the script, e.g.

cscript //I //E:Jscript run_programs.js
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.