Celeb Glow
general | March 05, 2026

run exe format in batch file

I want to make a batch file,which run 3 executable file respectively: A.exe B.exe C.exe


P.S: A.exe gotta finish its job then batch file go for B.exe and finally C.exe

2

1 Answer

A three line batch file would do. For example, a batch file called mybatch.bat...

START /wait notepad.exe
START /wait sol.exe
START /wait thirdExecutable.exe

the /wait parameter can also be replaced with /w, and instructs the batch script to wait until the executable terminates before proceeding to the next stage. Thus, you may elect not to use this parameter on the third line. Doing so would only cause the cmd window to remain open until the third executable has terminated.

EDIT TO ADDRESS COMMENT: I'm afraid that works for me. You might also make sure you replace the executable with the exact path to your executable files - for example, if A.exe was located in C:\MyFolder\, you would modify the first line to be START /wait C:\MyFolder\A.exe. This isn't required if the executables are in any folder referenced in the environmental variable %PATH% or are in the same folder as the batch file. I don't think this is your issue.

I wonder if those three cmd windows the batch opened were indeed the executable files you wished to run? The main window that opens with the batch file will echo the commands it is issuing, and will also display if it cannot execute the commands it is given. If you didn't get a pop-up error alert, then your batch file is finding and successfully running those three executables you specify.

As the link I provided also says, you may also use the parameter /minimized - or equivalently /m - in addition to /wait to execute the files minimised by default. This might make things perhaps a bit neater and look like what you were expecting.

As it stands, I think it is working exactly as intended. Exactly as you described the issue, anyway.

SECOND EDIT: Given your batch file, I've done the small changes necessary for it to do what you want. I don't actually know what you want to echo with the very beginning, but it should display enough information.

ECHO "programs are processing...."
ECHO "First Phase"
START /w "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vsvars32.bat"
ECHO "Second Phase"
START /w "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
ECHO "Final phase"
START /w "C:\Program Files\OPNET\16.0.A\sys\pc_intel_win32\bin\modeler.exe" 

Does this work as intended?

FINAL EDIT: You can get around the environmental variable thing, if you'll ever need to run this batch file somewhere where you don't have permissions to modify them.

ECHO "programs are processing...."
ECHO "First Phase"
C:
cd "\Program Files\Microsoft Visual Studio 9.0\VC\bin
START /w vsvars32.bat
ECHO "Second Phase"
cd ..
START /w vcvarsall.bat
ECHO "Final phase"
cd "\Program Files\OPNET\16.0.A\sys\pc_intel_win32\bin"
START /w modeler.exe

And that seems to get around the problem on my end. Ugly as anything, but batch files never did seem to be intrinsically beautiful...

8

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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