Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: 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 not so gray matter
12 Apr 2010
Default Batch Files - Start Multiple Programs At Once

Batch Files - Start Multiple Programs at Once

information   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



Published by
12 Apr 2010   #1
Thorsen

Win7 Home Premium 64x
 
 

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

Excellent Tutorial btw


My System SpecsSystem Spec
12 Apr 2010   #2
CommonTater

XP Pro SP3 X86 / Win7 Pro X86
 
 

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 System SpecsSystem Spec
12 Apr 2010   #3
not so gray matter

W7 Ult. x64 | OS X
 
 

Quote   Quote: Originally Posted by CommonTater View Post
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 System SpecsSystem Spec
.


13 Apr 2010   #4
Thorsen

Win7 Home Premium 64x
 
 

Quote   Quote: Originally Posted by CommonTater View Post
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 System SpecsSystem Spec
25 Feb 2013   #5
ROBO731

Windows 7 Home Premium x64
 
 

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

Ex: C:\Program Files (x86)\
My System SpecsSystem Spec
26 Feb 2013   #6
Thorsen

Win7 Home Premium 64x
 
 

Quote   Quote: Originally Posted by ROBO731 View Post
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 System SpecsSystem Spec
27 Feb 2013   #7
ROBO731

Windows 7 Home Premium x64
 
 

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:

Quote:
@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 System SpecsSystem Spec
27 Feb 2013   #8
Brink
Microsoft MVP

64-bit Windows 8.1 Enterprise
 
 

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 System SpecsSystem Spec
28 Feb 2013   #9
Thorsen

Win7 Home Premium 64x
 
 

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.
Quote:
@echo off
cd /d c:\asc
REM Hamachi
start hamachi.lnk
cd c:\asc
REM Privoxy
start privoxy.lnk
exit
My System SpecsSystem Spec
Comment

 Batch Files - Start Multiple Programs At Once




Tutorial Tools



Similar help and support threads for2: Batch Files - Start Multiple Programs At Once
Windows 7 Tutorial Category
search multiple files, copy+paste to new folder (batch file software?) General Discussion
Start (and stop) multiple programs with one click? Performance & Maintenance
Cannot start x86 Programs from exe files Software
Solved Batch files not opening some programs General Discussion
Launch all programs in the start menu all at once possibly using batch General Discussion
How to start multiple programs with ONE mouseclick ! Performance & Maintenance
Open Multiple Files one click - simple bat/batch file General Discussion

Our Sites

Site Links

About Us

Find 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 02:45 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33