Run multiple programs in one step

This tip applies to the Windows operating system.

There are instances when I want to run a set of programs. One example is shortly after I log on to my computer when would like to start up MS Outlook, Firefox, IE 64bit, and Forte Agent.

I wrote a VBS script, run through the Windows Script Host, that does the needful.

Create a text file (use Notepad if you want or MS Word)

Set WshShell = WScript.CreateObject(“WScript.Shell”)
WshShell.Run “”“%ProgramFiles(x86)%\Microsoft Sysinternals\procexp.exe”“”
WshShell.Run “”“%ProgramFiles(x86)%\mozilla firefox\firefox.exe”“”
WshShell.Run “”“%programfiles%\internet explorer\iexplore.exe”“”
WshShell.Run “”“%ProgramFiles(x86)%\microsoft office\office12\outlook.exe”“”
WshShell.Run “”“%ProgramFiles(x86)%\Agent\agent.exe”” c:\users\tm\Forte\Agent”

Save the file as “My Programs.vbs” or whatever you prefer. This is one of those rare instances when I would consider putting a file on the desktop. To run all the programs double click the file. Assuming you have the correct full program name in each line, that program will start running. An error on one line will terminate the script.

Note the required use of quotes around a program name when the name has a space in it. To insert a quote in a string one must use two consecutive quotes. Consequently, a quote at the start of a string requires three quotes in succession. The first starts the string and the next 2 cause the 1st character in the string to be a quote. Similar logic applies when the quote is at the end of the string. Otherwise, one would see just 2 consecutive quotes as after the .exe in the last line of the file.

The above uses the environment variables programfiles and ProgramFiles(x86), which map to the 64bit program directory and the 32bit program directory respectively. To not use them, replace the %variable% with the explicit path.

Set WshShell = WScript.CreateObject(“WScript.Shell”)
WshShell.Run “”“C:\Program Files (x86)\Microsoft Sysinternals\procexp.exe”“”
WshShell.Run “”“c:\program files (x86)\mozilla firefox\firefox.exe”“”
WshShell.Run “”“c:\program files\internet explorer\iexplore.exe”“”
WshShell.Run “”“c:\program files (x86)\microsoft office\office12\outlook.exe”“”
WshShell.Run “”“C:\Program Files (x86)\Agent\agent.exe”” c:\users\tm\Forte\Agent”

Tushar Mehta
www.tushar-mehta.com

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>