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
Command Prompt Shortcuts
#1
Posted 26 April 2009 - 08:49 AM
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
#2
Posted 26 April 2009 - 11:56 AM
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.
#3
Posted 26 April 2009 - 12:33 PM
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.
#4
Posted 26 April 2009 - 06:38 PM
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.
#5
Posted 26 April 2009 - 06:44 PM
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.
#6
Posted 26 April 2009 - 08:37 PM
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.
#7
Posted 27 April 2009 - 07:01 AM
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.
#8
Posted 27 April 2009 - 09:41 AM
#9
Posted 27 April 2009 - 02:13 PM
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:
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 messageC:\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;
'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.
#10
Posted 27 April 2009 - 04:33 PM
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?
#11
Posted 27 April 2009 - 05:00 PM
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...
#12
Posted 27 April 2009 - 05:13 PM
That would be a neat little program though.
#13
Posted 27 April 2009 - 05:19 PM
#14
Posted 27 April 2009 - 05:24 PM
#15
Posted 27 April 2009 - 05:35 PM
I'll work on the C:\Users\Area 52\Shortcuts part now then.
Similar Topics
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users