Using a batch file to run 2 commands in order

Posted on 2013-10-01
Medium Priority
1 Endorsement
Last Modified: 2013-10-01
I want to create a batch file that runs 2 executable files but one command has to complete before running the other. All I have is the locations of the two executable files. What other commands to I need to ensure the batch file runs the first command and completes it, then runs the second command
Question by:DonKwizote
  • 3
  • 2

Expert Comment

ID: 39536955
Use the batch call function

Call abc.bat

call xyz.bat

xyz will NOT execute before abc

Expert Comment

ID: 39536965
Have a llok here for explanation.

LVL 60

Accepted Solution

Bill Prew earned 2000 total points
ID: 39536978
You want to use the START command for this, as in:

    START /WAIT program1.exe
    START /WAIT program2.exe

If there are spaces in the EXE path and you need to quote it, then you also need an extra parm (can be empty) as shown here:

    START "" /WAIT "c:\program files\foo\program1.exe"
    START "" /WAIT "c:\program files\foo\program2.exe"

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 60

Expert Comment

by:Bill Prew
ID: 39536984
The CALL statement is only used to call another BAT file from an initial BAT file, not EXE files.  For that we need the START command.


Author Closing Comment

ID: 39537034
Thank you. It worked perfectly
LVL 60

Expert Comment

by:Bill Prew
ID: 39537356


Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Assume you have an outside contractor who comes in seasonally or once a week to do some work in your office, but you only want to give him access to the programs and files he needs and keep all other documents and programs private. Can you do this o…
While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.

619 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question