Saturday, July 11, 2009

Multiple Programs with One Shortcut

First, open up Notepad and start a new document. We will put all of our code here.

First we need to turn off command echoing. This is not neccessary, but can be quite annoying. This will only help if you are going to directly run the command through CMD.
Type in this code

CODE
@echo off

That will turn off our command echoing.

Now to running the programs. I will use two programs as an example. I will also use fake folders and stuff.

Type in this code after the first command.

CODE
rem Guild Wars
cd C:\Program Files\Guild Wars
start gw.exe
rem Firefox
cd C:\Program Files\Mozilla Firefox
start firefox.exe


That code will change to those directories then run the appropriate executable file.
Those are example directories. The rem command simply means a comment/remarks.

This is the template for the programs.

CODE
cd Path to program
start Program .exe file

That is all to run the program.
Well, let's add one more command to close CMD after it is finished. This also will make it seem like CMD did nothing.

CODE
exit


So our final code should look like this:

CODE
@echo off
rem Guild Wars
cd C:\Program Files\Guild Wars
start gw.exe
rem Firefox
cd C:\Program Files\Mozilla Firefox
start firfox.exe
exit


Ok after you have your code written, save the file as a .bat file. The file name is up to you. The file name though will be the command name. I will call mine guildfire.bat.

Ok, we have our program. What about the shortcut? Well I am going to explain that.

After you have the file saved. Be sure to remember where you saved it.

On your desktop, right click and create a new shortcut. When it asks you about the target, direct the target to the batch file we just made. Change the name and save. You just made a program starting program.

If you want to change the image
To change the shortcut's icon
, simply go to it's properties and it should have a place to change the Icon
Image. Simply change it with something like a BMP file. The best image size for the icon is about 50x50.

No comments:

Post a Comment