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

Sleep 3
Sleep 5
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?


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


Use the Start command. Change your batch to this:

Start Program1.exe
Sleep 3
Start Program2.exe
Sleep 5
Start Program3.exe
Sleep 11
  • 3
    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 Dec 27 '10 at 2:50
  • Having the same problem and removing the quotes doesn't make it work either. Dec 28 '10 at 19:13
  • do these apps open? is it perhaps a path issue?
    – datatoo
    Dec 30 '10 at 13:09

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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