|
|
|
|
![]() ![]() |
Dec 14 2007, 08:52 PM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 232 Joined: 5-October 07 From: Random Places Member No.: 51,171 ![]() |
Welcome to my turoial on how to start multiple programs using one shortcut. You may probably be wondering how this is possible. Well this tutorial will use a language from MS-DOS called batch. I am not sure whether it is "language", but I do know that it is a way to program for MS-DOS. Batch is simply a way to run several MS-DOS commands with just one command. All batch files are run through Command Prompt, but they can be accessed with shortcuts also. Here are a few requirements for this tutorial.
Requirements
Ok, let's go on and start our tutorial. 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. 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. Thank you for reading this tutorial and I hope you have fun. |
|
|
|
Feb 24 2008, 03:37 AM
Post
#2
|
|
|
Newbie ![]() Group: Members Posts: 2 Joined: 24-February 08 Member No.: 58,345 |
I found this tutorial using Google.
It was just what I needed except for one thing. My hard drive is partitioned, and the two applications I wanted to run were on drives C: and D: The bat file could only find the application that was on the same drive as it was, so I had to move the second app. Then it worked great! Thanks |
|
|
|
Feb 24 2008, 11:56 AM
Post
#3
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 500 Joined: 13-December 06 Member No.: 35,271 |
Very good tutorial, I'll be using this. Thank you coolcat!
|
|
|
|
Feb 24 2008, 09:01 PM
Post
#4
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 132 Joined: 23-September 07 Member No.: 50,511 |
I was actually looking for something just like this. Thank you so much.
Now, just one question to take it a step further. Is it possible to write a shortcut that terminates one application and launches another? For example, I use RocketDock on my desktop because I prefer it to the native quicklaunch. I want to be able to launch games off RocketDock, but whenever I do, there is a strange flicker and I'm forced to ALT+TAB back to the desktop and shut it off manually. Is there a way to write a shortcut that will both close RocketDock and launch another app? |
|
|
|
Feb 25 2008, 03:08 AM
Post
#5
|
|
|
Newbie ![]() Group: Members Posts: 2 Joined: 24-February 08 Member No.: 58,345 |
It was just what I needed except for one thing. I've come across a couple more 'quirks' as I've been using it.
![]() |
|
|
|
Feb 25 2008, 01:01 PM
Post
#6
|
|
|
Trap Grand Marshal Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 1,283 Joined: 11-January 06 From: Chennai, India Member No.: 16,932 |
I normally use this script for opening the folders and applications that I need to work from a single batch file.
The batch can be programmed to do whatever we need to do on a regular basis, it can be use to save time and automate tasks. |
|
|
|
Feb 29 2008, 12:28 PM
Post
#7
|
|
|
Newbie ![]() Group: Members Posts: 1 Joined: 29-February 08 Member No.: 58,656 |
I've come across a couple more 'quirks' as I've been using it.
![]() I have a .bat file that executes the following when I want to play Dota on dota-league: CODE @echo off cd C:\Program Files\Games\Warcraft III\DGN start DotAClient.exe cd.. start inventory.exe "Frozen Throne.exe" In the folder "C:\Program Files\Games\Warcraft III\DGN" I have the DotaClient and in the folder under it "C:\Program Files\Games\Warcraft III" I have Frozen Throne and an inventory add-on. With the command "cd.." (without "") I can go one folder down in dos and it also works when coding. My point here is, that in most cases you don't (but to be sure you usually can) need to add start in front of the application you're executing and especially if the application has two words cut the start and just add "program name .exe" and it will execute it. Hope this helps. |
|
|
|
Mar 14 2008, 01:40 PM
Post
#8
|
|
|
Newbie ![]() Group: Members Posts: 1 Joined: 14-March 08 Member No.: 59,306 |
To fix the problem with multiple drives, you need to first change to that drive and then change to the directory of the .exe. For example, if you have Guild Wars.exe on your C: drive and Firefox.exe on your D: drive, you code would be:
rem Guild Wars cd C:\Program Files\Guild Wars start gw.exe rem Firefox rem changing to D: drive D: rem changing to the root of D: cd \ cd D:\Program Files\Mozilla Firefox start firefox.exe As far as a path that has spaces or special characters, usually Windows XP will work fine with commands with spaces, but if you have problems, always include quotes around your path: "C:\Program Files\Internet Explorer\Connection Wizard" Older Operating Systems like Windows 98 (9x) can't have path segments longer than 8 characters, so you have to truncate the segments like this: "C:\Progra~1\Intern~1\Connec~1" One final note. What I always do when I'm done with my batch file is manually test the commands. I open up the batch file in Notepad (or your favorite text editor) and also open a command prompt. Then I systematically type in each command one at a time, following the commands in my batch file. This allows you to immediately see where your Batch file is getting hung up. Normally when batch files run, the commands are displayed on the screen so fast that if there is an error, you can't see what it was. Typing the commands manually as a test allows you to systematically see what's going on during each step. |
|
|
|
Mar 14 2008, 04:28 PM
Post
#9
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 198 Joined: 30-January 08 Member No.: 57,072 |