IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
3 Pages V   1 2 3 >  
Reply to this topicStart new topic

Start Multiple Programs With One Shortcut

, Windows XP


coolcat50
no avatar
Super Member
*********
Group: Members
Posts: 303
Joined: 5-October 07
From: Random Places
Member No.: 51,171
Spam Patrol
myCENT:65.80



Post #1 post Dec 14 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
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.
Go to the top of the page
+Quote Post
watehey
no avatar
Newbie
*
Group: Members
Posts: 2
Joined: 24-February 08
Member No.: 58,345



Post #2 post Feb 24 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
Go to the top of the page
+Quote Post
Forbez
no avatar
Privileged Member
*********
Group: [HOSTED]
Posts: 662
Joined: 13-December 06
Member No.: 35,271
myCENT:49.54



Post #3 post Feb 24 2008, 11:56 AM
Very good tutorial, I'll be using this. Thank you coolcat!
Go to the top of the page
+Quote Post
suberatu
no avatar
Advanced Member
*******
Group: Members
Posts: 131
Joined: 23-September 07
Member No.: 50,511



Post #4 post Feb 24 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?
Go to the top of the page
+Quote Post
watehey
no avatar
Newbie
*
Group: Members
Posts: 2
Joined: 24-February 08
Member No.: 58,345



Post #5 post Feb 25 2008, 03:08 AM
QUOTE(watehey @ Feb 23 2008, 09:37 PM) [snapback]375724[/snapback]
It was just what I needed except for one thing.

I've come across a couple more 'quirks' as I've been using it.
  1. The filename cannot have spaces - had to replace them with underscores '_'
  2. 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.
Go to the top of the page
+Quote Post
delivi
no avatar
Trap Grand Marshal Member
***********
Group: [HOSTED]
Posts: 1,320
Joined: 11-January 06
Member No.: 16,932
myCENT:NEGATIVE[-455.29]



Post #6 post Feb 25 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.
Go to the top of the page
+Quote Post
sieni
no avatar
Newbie
*
Group: Members
Posts: 1
Joined: 29-February 08
Member No.: 58,656



Post #7 post Feb 29 2008, 12:28 PM
QUOTE(watehey @ Feb 25 2008, 05:08 AM) [snapback]375894[/snapback]
I've come across a couple more 'quirks' as I've been using it.
  1. The filename cannot have spaces - had to replace them with underscores '_'
  2. 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.


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

[codebox]@echo off
cd C:\Program Files\Games\Warcraft III\DGN
start DotAClient.exe
cd..
start inventory.exe
"Frozen Throne.exe"[/codebox]

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.
Go to the top of the page
+Quote Post
clutch
no avatar
Newbie
*
Group: Members
Posts: 1
Joined: 14-March 08
Member No.: 59,306



Post #8 post Mar 14 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.
Go to the top of the page
+Quote Post
demank
no avatar
Super Member
*********
Group: [HOSTED]
Posts: 200
Joined: 30-January 08
Member No.: 57,072



Post #9 post Mar 14 2008, 04:28 PM
thanks a lot..
I really like this tutorial...
great for you for sharing this tutorial., smile.gif
Go to the top of the page
+Quote Post
coolcat50
no avatar
Super Member
*********
Group: Members
Posts: 303
Joined: 5-October 07
From: Random Places
Member No.: 51,171
Spam Patrol
myCENT:65.80



Post #10 post Mar 15 2008, 04:40 AM
Well, some things I am not sure about. Thanks for some of the tips though. I never knew about those.
Go to the top of the page
+Quote Post

3 Pages V   1 2 3 >
Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   11 thewebkid 3,053 11th April 2009 - 05:00 AM
Last post by: zakaluka
No New Posts   0 OpaQue 12,313 1st August 2004 - 12:42 PM
Last post by: OpaQue
No New Posts 10 champagne 16,980 28th August 2004 - 07:21 AM
Last post by: hatebreed
No New Posts   10 DataHead 14,118 7th December 2007 - 04:37 PM
Last post by: keego
No New Posts   6 winflowers 9,042 11th September 2004 - 09:14 PM
Last post by: MSTR
No New Posts   7 MSTR 10,759 26th September 2004 - 08:26 AM
Last post by: Spectre
No new   16 Saint_Michael 18,484 20th August 2009 - 06:09 PM
Last post by: ENDY_JASMI
No New Posts   7 brautigam 2,017 13th August 2006 - 06:05 PM
Last post by: delivi
No New Posts   1 solankyno1 3,693 5th October 2004 - 08:08 PM
Last post by: Saint_Michael
No New Posts   10 mizako 13,229 5th November 2004 - 08:57 PM
Last post by: xboxrulz
No New Posts   0 odomike 4,343 20th June 2006 - 06:01 AM
Last post by: odomike
No New Posts   2 mizako 3,853 14th October 2004 - 10:03 PM
Last post by: pbrugge
No new   25 nicky1 21,866 31st October 2009 - 01:14 PM
Last post by: TheDarkHacker
No New Posts   2 no9t9 3,525 11th November 2004 - 04:35 PM
Last post by: finaldesign
No New Posts 7 karlo 2,903 3rd December 2004 - 01:03 AM
Last post by: karlo


 



RSS Open Discussion Time is now: 8th November 2009 - 10:06 AM

Web Hosting Powered by ComputingHost.com.