Starting two exe with one bat file how do i do it?

Posted on 2004-12-01
Last Modified: 2008-03-06
Hi all,

I was trying to write a bat file that will execute 2 exe. The way i want to do it is i will execute the first exe and do some task. The second exe will only being executed when teh first 1 completed.

How can I write the script in the bat file? Any special commands or any sites to reccomend. Thanks a lot and your help would be appreciated!

Question by:IxCraZee
    LVL 1

    Expert Comment

    1. create a file xyz.bat.
    2. just enter the name of the file (with complete path if they are not in the same directory)
    3. save it
    4. execute it, eg. xyz

    @echo off (this will not show the commands while executing)

    you can give as many filenames as you want to execute.

    Also you can use "Pause" within the batch file. What it simple does is show a line Press any key to continue... and wait for a key hit.

    Also visit:
    LVL 1

    Expert Comment

    You can better control your programs execution if you use Windows Scripting Host, which is already installed by default.  The Run() method for instance offers rich options, depending on the integer value you pass in:

    0 Hides the window and activates another window.
    1 Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
    2 Activates the window and displays it as a minimized window.  
    3 Activates the window and displays it as a maximized window.  
    4 Displays a window in its most recent size and position. The active window remains active.
    5 Activates the window and displays it in its current size and position.
    6 Minimizes the specified window and activates the next top-level window in the Z order.
    7 Displays the window as a minimized window. The active window remains active.
    8 Displays the window in its current state. The active window remains active.
    9 Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
    10 Sets the show-state based on the state of the program that started the application.

    More information and samples can be found on MSDN:
    LVL 3

    Accepted Solution

    Use the "start /wait" command.


    @echo off
    start /wait prog1.exe
    start /wait prog2.exe

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    This article was inspired by a question here at Experts Exchange ( The requirements stated in that question are (1) reduce the file size of a large number of…
    Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now