Batch Files - Start Multiple Programs At Once

Page 1 of 2 12 LastLast
    Batch Files - Start Multiple Programs At Once

    Batch Files - Start Multiple Programs At Once

    How to Use a Batch File to Run Multiple Programs
    Published by
    Designer Media Ltd


    Batch Files - Start Multiple Programs at Once

       Information
    All of the work done in this tutorial will be done through MS DOS Batch Files. They are simply a method by which to enter multiple commands into a command prompt without manually typing them. Batch files are run through Command Prompt but can be accessed by shortcuts as well.


    Open a New Document in Notepad

    Open a New Document in Notepad and save it as filename.bat, choose a filename that is easy to remember.

    Command Echoing

    The first thing we're going to do is turn off command echoing. It isn't an integral part of this tutorial, but becomes annoying when running the batch file through command prompt.

    Enter this line in Notepad:
    @echo off

    Starting up the Programs

    This next set of lines will start the programs. I will use real directories for programs that everyone has in order to show the process properly. The rem command is simply a comment, the cd command changes the directory and start is self-explanatory.

    Enter these lines:
    rem Notepad
    cd %windir%\system32
    start notepad.exe
    rem Calculator
    cd %windir%\system32
    start calc.exe

    Closing Command Prompt

    No one wants to run a batch file and leave a command prompt open, so now we'll add a line to close it.

    Enter this line:
    Exit

    • Confirmation

    The final text document will look like this:

    @echo off
    rem Notepad
    cd %windir%\system32
    start notepad.exe
    rem Calculator
    cd %windir%\system32
    start calc.exe
    exit

    Save & Create a Shortcut

    Now you'll need to save the file as filename.bat. In reality the name can be *ANYTHING*.bat but name it something you can type easily since it'll be placed in the target command of the shortcut.

    Now create a shortcut. It doesn't matter where you saved the .bat file, unless you plan on writing in the shortcut parameters instead of right clicking and sending the shortcut to the desktop.

    Change the Icon for the Shortcut

    Now you can change the icon for the shorcut.

    Right Click Shorcut > Properties > Change Icon Box > OK > Choose From Available Icons






  1. Posts : 3,300
    Win7 Home Premium 64x
       #1

    I usually also change the Icon for the shortcut so it doesn't look like a .bat file

    Excellent Tutorial btw
      My Computer


  2. Posts : 1,170
    XP Pro SP3 X86 / Win7 Pro X86
       #2

    Actually since System32 is part of the windows search path and START is unneeded when launching a program you could have simpy used...

    notepad
    calc

    that's it... two simple one word lines... are all you really needed.

    Don't believe me? Try it.
      My Computer


  3. Posts : 1,506
    W7 Ult. x64 | OS X
    Thread Starter
       #3

    CommonTater said:
    Actually since System32 is part of the windows search path and START is unneeded when launching a program you could have simpy used...

    notepad
    calc

    that's it... two simple one word lines... are all you really needed.

    Don't believe me? Try it.
    That's true, but it's much better to include the start line in the tutorial because people new to tutorials might think it's not necessary ever. It's much better to include optional commands because when they become necessary, the average user will have them there. Not to mention the fact that it doesn't hurt anything to keep them in there.
      My Computer


  4. Posts : 3,300
    Win7 Home Premium 64x
       #4

    CommonTater said:
    Actually since System32 is part of the windows search path and START is unneeded when launching a program you could have simpy used...

    notepad
    calc

    that's it... two simple one word lines... are all you really needed.

    Don't believe me? Try it.
    Interesting I have not tried this.
      My Computer


  5. Posts : 223
    Windows 7 Home Premium x64
       #5

    How do you reference a directory that has spaces in it?

    Ex: C:\Program Files (x86)\
      My Computer


  6. Posts : 3,300
    Win7 Home Premium 64x
       #6

    ROBO731 said:
    How do you reference a directory that has spaces in it?

    Ex: C:\Program Files (x86)\

    put the whole thing in quotes: "C:\Program Files (x86)\"
      My Computer


  7. Posts : 223
    Windows 7 Home Premium x64
       #7

    Oh, right, thanks, but now I'm encountering the same problem I was having even with the quotes. Whenever I try to run it, it says it can't find the exe files. Here's the exact script:

    @echo off
    rem Hamachi
    cd "C:\Program Files (x86)\LogMeIn Hamachi"
    start hamachi-2.exe
    rem Privoxy
    cd "C:\Program Files (x86)\Privoxy"
    start privoxy.exe
    exit
    Also, is there a way to run one of these programs with administrator privileges?
      My Computer


  8. Posts : 72,043
    64-bit Windows 11 Pro for Workstations
       #8

    Hello Rob,

    The batch file looks correct to me.

    Are you sure those are the correct folder locations that the .exe files are in?

    Could you post screenshots of these folder locations showing the .exe files in them to see what the issue may be?



    To "Run as administrator" for an .exe, you could use Option Five or Option Six in the tutorial below to set it to always "Run as administrator".

    Run as Administrator

    Hope this helps for now, :)
    Shawn
      My Computer


  9. Posts : 3,300
    Win7 Home Premium 64x
       #9

    If your command prompt isn't coming up in c:\ when it launches, then the cd c:\"... " won't work. you will need to use "/d" to make this switch to the c:\

    (this can happen if you have more than 1 hdd and c: isn't your primary or if you have a home or network drive assigned that shows up instead as the default)


    I think option 5 and 6 will still give you a UAC prompt. you could use option 7 if you don't want the prompt. Elevated Program Shortcut without UAC Prompt - Create

    and then have the batch file execute the shortcut.

    Example: I would create a folder like C:\ASC\ (short for admin short cuts) and then create your shortcuts there.
    @echo off
    cd /d c:\asc
    REM Hamachi
    start hamachi.lnk
    cd c:\asc
    REM Privoxy
    start privoxy.lnk
    exit
    Last edited by Thorsen; 28 Feb 2013 at 10:17. Reason: many many edits lol
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 18:27.
Find Us