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
Published by

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




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 10 Pro build 11082
 
 

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
Windows 7 Tutorial Category
Batch Files not working when trying to open programs
I was trying to create a batch file to open up two programs which I mostly always start and use when I login and so I attempted to create the batch file following this: Launch Multiple Programs From A Single Shortcut Using A Batch File While I managed to do all the actual "coding" part of it ...
General Discussion
search multiple files, copy+paste to new folder (batch file software?)
I am a complete newbie when it comes to batch files and batch file software, so apologies in advance. I've done some research on Google etc but I seem to just be getting more and more confused trying to use various different scripts and programs and reading different info on various websites. ...
General Discussion
Cannot start x86 Programs from exe files
Hello, I've run across a weird error that is making me bang my head against the wall... I am running windows professional x64 I cannot seem to start any x86 programs from their shortcuts, or exe files. The problem exists in both regular and safe mode. When I click the exe or shortcut,...
Software
Batch files not opening some programs
Ohai. It's been a while since I've been here. Didn't help that I'd forgotten my username and password. Anyway, recently I decided to start using batch files to open programs when I want to run several in one go, rather than running all of them at startup. Should save some time if I ever want to...
General Discussion
Launch all programs in the start menu all at once possibly using batch
Launch all programs in the start menu all at once possibly using batch Yes, hey, hello well I came across this video a while ago and although what I'm after isn't linked to the main point of the video, for my own testing purposes I would like to be able to do this myself also the Office only one...
General Discussion
Open Multiple Files one click - simple bat/batch file
Hey, I have a simple batch file to load multiple files with one click, but it's not working. When I run it, it simply very quickly pops up the cmd dialog, which quickly disappears, and nothing is loaded. I've tried 'running as administrator' - same problem. File is xxxxx.bat
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 15:08.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App