Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Start Multiple Programs With One Shortcut


37 replies to this topic

#1 coolcat50

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 303 posts
  • Gender:Male
  • Location:Random Places
  • myCENT:65.80
  • Spam Patrol

Posted 14 December 2007 - 08:52 PM

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
  • Windows XP (I tested this on XP, but it should work on many Windows systems)
  • Some programs
  • Notepad
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
@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.
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.
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.
exit

So our final code should look like this:
@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.

#2 watehey

    Newbie

  • Kontributors
  • Pip
  • 2 posts

Posted 24 February 2008 - 03:37 AM

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

#3 Forbez

    Privileged Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 662 posts

Posted 24 February 2008 - 11:56 AM

Very good tutorial, I'll be using this. Thank you coolcat!

#4 suberatu

    Advanced Member

  • Kontributors
  • PipPipPipPipPipPipPip
  • 131 posts
  • Gender:Male

Posted 24 February 2008 - 09:01 PM

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?

#5 watehey

    Newbie

  • Kontributors
  • Pip
  • 2 posts

Posted 25 February 2008 - 03:08 AM

View Postwatehey, on Feb 23 2008, 09:37 PM, said:

It was just what I needed except for one thing.
Posted Image I've come across a couple more 'quirks' as I've been using it.
  • The filename cannot have spaces - had to replace them with underscores '_'
  • I had one path that had an ampersand '&' in it - it couldn't open the file.
These may just be typical characteristics of using DOS commands, I don't know much about that. Posted Image

#6 delivi

    Trap Grand Marshal Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,320 posts

Posted 25 February 2008 - 01:01 PM

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.

#7 sieni

    Newbie

  • Kontributors
  • Pip
  • 1 posts

Posted 29 February 2008 - 12:28 PM

View Postwatehey, on Feb 25 2008, 05:08 AM, said:

Posted Image I've come across a couple more 'quirks' as I've been using it.
  • The filename cannot have spaces - had to replace them with underscores '_'
  • I had one path that had an ampersand '&' in it - it couldn't open the file.
These may just be typical characteristics of using DOS commands, I don't know much about that. Posted Image

I have a .bat file that executes the following when I want to play Dota on dota-league:

@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.

#8 clutch

    Newbie

  • Kontributors
  • Pip
  • 1 posts

Posted 14 March 2008 - 01:40 PM

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.

#9 demank

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 200 posts
  • Gender:Male

Posted 14 March 2008 - 04:28 PM

thanks a lot..
I really like this tutorial...
great for you for sharing this tutorial., <_<

#10 coolcat50

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 303 posts
  • Gender:Male
  • Location:Random Places
  • myCENT:65.80
  • Spam Patrol

Posted 15 March 2008 - 04:40 AM

Well, some things I am not sure about. Thanks for some of the tips though. I never knew about those.




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users