Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Command Prompt Shortcuts


  • Please log in to reply

#1
WhydoIask?

WhydoIask?

    Member

  • Member
  • PipPipPip
  • 169 posts
One of the things I want to accomplish is to run my vista computer from the command prompt for 1 day. I just think it would be very tedious to have to go to every path to every program to run it. I want to know how to create shortcuts for the command prompt.

Ex: instead of having to type my way to C:\program files\ccleaner to run ccleaner.exe, I want to be able to type "CCleaner" directly into the command prompt, and it would know to co to "C:\program files\ccleaner" and run ccleaner.exe
  • 0

Advertisements


#2
Neil Jones

Neil Jones

    Member 5k

  • Member
  • PipPipPipPipPipPipPipPip
  • 8,476 posts
Why do you need to run these programs from a command prompt?
Would it not be easier to make new shortcuts and put them on the desktop?

Anyway under Vista normally you can just type the filename of the program in question into the search box at the bottom of the Start Menu.
  • 0

#3
WhydoIask?

WhydoIask?

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 169 posts
If you read what I said, I want to see what its like to run the computer entirely from the command prompt, just to see if it could be done in a way that wouldn't slow down my progress to a crawl, and that would require shortcuts in the CMD. There is already one for notepad on it, how do I do it for the programs I want?

Also: even if I could put shortcuts to even half of my programs on the desktop, it would be a hard job to find the right one. :)
  • 0

#4
Onaipian

Onaipian

    Notepad warrior

  • Retired Staff
  • 2,130 posts
Hello :)

Well.. It's not really that easy. What Neil Jones suggested would be easier.

I don't believe you can make "cmd shortcuts"... But if you wanted to do something similar, you could do two things;

Option 1.
You can make copies (shortcuts won't work) of all the files you want to open, and place them in:
C:\Documents and Settings\%username% OR C:\Users\%username%
which is where the command prompt opens to. Then you would just need to type:
START CCleaner.exe

Option 2.
You can open the command prompt and type:
CD /D C:\Program Files\ccleaner
Then type:
START CCleaner.exe

Option 2 is practically the same as what you are doing now, but what I would do, is make a folder called 'Copies' or something and put them all there. Then just open the Command Prompt and type:
CD /D C:\Copies
Then you can use the START command to open any of the files. If you were really lazy, you could even make a batch file for your Desktop that would do the CD command for you. But you would have to do the START command by yourself; unless you're in the mood for some C++...

By the way; CD /D changes the directory the command prompt is open to. And START, starts programs... though you probably have already figured out the latter.
  • 0

#5
WhydoIask?

WhydoIask?

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 169 posts
Thanks, I like #1 the best.

But, no matter what directory the CMD is at, just typing "notepad" and nothing else, not even "start" (which you don't need anyway) opens a blank notepad document. There's no way to do something like that?

And C++ is wwwwaaaaaaaaaayy out of my league.
And I don't know about the XP command prompt, but in Vista, I just type "cd\" not "cd /d"

Edited by WhydoIask?, 26 April 2009 - 06:49 PM.

  • 0

#6
Onaipian

Onaipian

    Notepad warrior

  • Retired Staff
  • 2,130 posts
Sorry. I try my best to change everything for Vista, but I'm not very fond of it yet..

I believe Notepad is one of the few special commands like that.. I think that the commands are hard-coded in the Command Prompt executable itself, so we can't edit commands.

You got me interested now. I'm going to work on a program that does what you said... It shouldn't be hard, the only problem is that the locations of the file always are different, and I am by no means an expert at programming.
  • 0

#7
Jonesey

Jonesey

    Member

  • Member
  • PipPipPip
  • 335 posts
You might get where you want by creating batch files for the programs you want to access, and just run them from your dekstop.

I just created one in notepad called WMPlayer.bat

It contains these 3 lines:

cd c:\"Program Files"
cd "Windows Media Player"
wmplayer.exe


Runs perfectly.
  • 0

#8
Onaipian

Onaipian

    Notepad warrior

  • Retired Staff
  • 2,130 posts
Yes, but if you were going to do that for a whole day, you would need a lot of batch files. I still think that Neil Jones is right in saying that it would be easier just to make shortcuts.
  • 0

#9
SongCloud

SongCloud

    Member

  • Member
  • PipPipPip
  • 121 posts
Actually, piano9playa5 is almost correct.

The reason that notepad works is because the directory where it resides is already listed in the path variable. You can see this if you type the following at the command prompt.
echo %path%
This will list the entire contents of the path variable. For example the output of mine looks like this:

C:\Users\SongCloud>echo %path%
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\CA\SharedComponents\ScanEngine;C:\Program Files\CA\SharedComponents\CAUpdate\;C:\Program Files\CA\SharedComponents\ThirdParty\;C:\Program Files\CA\SharedComponents\SubscriptionLicense\;C:\Program Files\CA\eTrustITM;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\9.0\DLLShared\;C:\Program Files\Smart Projects\IsoBuster;C:\WCD\bin;

As you can see, the directory that notepad resides in which is C:\Windows is listed in the path. When you type something into the command prompt either via the Run dialog box or at the prompt itself in a command window, Windows checks first to see if that is a known command. If it is not, it looks for a program with that name in the folder that you are currently in. If it find nothing there, it searches the path one entry at a time for any program with a matching name. If it finds one, it will run it. If it does not find a matching program, you get the familiar error message

'XXXXXXX' is not recognized as an internal or external command, operable program, or batch file


You can add directories to the path 2 ways. The first way is good if you only want the directory that you are going to add to last for a single session (ie, when you close the command prompt, the changes you have made to the path variable are lost). To do this you would type the following at the command prompt:
set path=%path%;PATH_TO_DIRECTORY1;PATH_TO_DIRECTORY2;ETC.
Of course you would replace PATH_TO_DIRECTORY1;PATH_TO_DIRECTORY2;ETC. with whatever directory you need. Make sure to separate the different directories with a ";".

If you want a more permanent solution, you would need to set the path in the environment options in the system properties area. To do this, simply right click on My Computer and click Properties. When the windows opens, select Advanced System Settings from the Tasks menu on the left. This will open a new window named System Properties. Click on the button named Environment Variables and scroll down in the system variables area until you see a variable named path. Click on it and then click on Edit. From here, simply add the directories that you want to the end of the list that is already there.

REMOVING DIRECTORIES FROM THE PATH ENVIRONMENT VARIABLE CAN CAUSE PROGRAMS AND SHORTCUTS TO NOT WORK. PLEASE EDIT IT WITH CAUTION

I do, however, agree that it would be much easier to copy all of the programs that you might need into a single directory so that you only have to add that to the path variable.

Feel free to let me know if you have any questions. :)
  • 0

#10
WhydoIask?

WhydoIask?

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 169 posts
I pretty much got it.

I added "C:\Users\Area 52\Shortcuts\" to the end of the variable, and the only quirk is that I have to type "start" before every command, but piano9playa5 said you could make a batch file that types "start" for you.

I'm new to batch files, I only know about them because I watched some tutorials on them from JimmyR.com, so how would I go about making one that does that?
  • 0

#11
Onaipian

Onaipian

    Notepad warrior

  • Retired Staff
  • 2,130 posts
Sorry. I should have made it more clear. If you read it carefully, you'll see that I said "CD command".. I didn't mean to imply "start command" also. My fault.

On the flip, my program is ready to be tested, but I'm not sure if I'm allowed to post to homemade .exe's...
  • 0

#12
WhydoIask?

WhydoIask?

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 169 posts
My apologies, i did misread it.

That would be a neat little program though.
  • 0

#13
Onaipian

Onaipian

    Notepad warrior

  • Retired Staff
  • 2,130 posts
It's interesting, sure. But the problem with it, is that I would need to program it specifically for each file. If the files were in one folder, then I might be able to make it work for any file... I could even make it so that the user could choose the folder, so that it can work from computer to computer..
  • 0

#14
WhydoIask?

WhydoIask?

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 169 posts
Well, as I said above, I made a folder, and am adding shortcuts, and my vista computer is a laptop, so I wouldn't be going computer to computer, I can just carry mine around.
  • 0

#15
Onaipian

Onaipian

    Notepad warrior

  • Retired Staff
  • 2,130 posts
I meant from user to user.. As in if I wanted to use the program also, and I'm on XP, so I don't have a "users" directory.. So the folders would be different. :)

I'll work on the C:\Users\Area 52\Shortcuts part now then.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP