4.8. Creating a Program Alias


You want to create a program alias for an application or commonly accessed file. A program alias is a little different from a shortcut or link. It is similar in function to the alias command common on most Unix platforms. The alias name can be used as an alternative to typing the full program name. For example, let's say you use the Computer Management snap-in a lot and instead of going to Start menu Administrative Tools Computer Management, you prefer to type compmgmt.msc from the Run dialog or from the command line. You could create a program alias called cmp that points to compmgmt.msc, which reduces the number of characters you have to type by nine.


The following is how you'd create the cmp alias I just described.

Create a new subkey under the following key:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths

The name of the subkey should be the alias name. So you don't have to type an extension when using the alias, put .exe at the end of the name. In this case, the subkey name would be cmp.exe. You can, in fact, call the alias anything you want, but if the alias extension is not an executable extension such as .exe, you'll have to type the complete alias name when calling it. So it is perfectly fine to name the subkey cmp.abc, but I'd have to type cmp.abc instead of just cmp when typing it in the Run dialog.

Next, modify the default value under the new subkey; it shows up with the name (Default) in Registry Editor. Enter the full path to the program you are creating an alias for, which in this example would be C:\Windows\system32\compmgmt.msc. Actually, if the program is in your path, you only need to put the program name and the system will find it for you, but you are probably better off putting the complete path so there is no mistake which program you want to run.

Now you'll be able to run cmp from the Run dialog. From a command prompt, you can't just type cmp and have it launch the program. Instead you need to type start cmp, which will do the trick.


There are a couple of things to keep in mind when entering the path to the program in the value under the subkey:

  • Don't use environment variables such %SystemRoot%. It won't work.

  • Passing parameters to the program (which would have made aliases even more useful) also doesn't seem to work.

You can force the program to start in a particular directory by creating a Path value under the alias subkey. Create a REG_SZ value entry named Path, and for its value put the full path to the directory where the program should start in.

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.