tags:

views:

58

answers:

5

How do you register a name for a program in the windows run dialog?

for instance typing in "notepad" and pressing enter runs notpad.exe "photoshop" in my case runs Photoshop CS3

im using vb2005.net

+3  A: 

This works because those applications have added the directory containing their executable to Window's PATH variable. This variable is used to resolve the locations of any files entered into the run dialog (among other things).

Please see How to set the path in Windows 2000 / Windows XP.

Andrew Hare
FWIW, modifying the %PATH% environment variable is pretty intrusive to the system since it can change the behavior of other apps, especially if your program's directory includes other executables (e.g. Python) which may be present in multiple versions on the machine. So modifying the path should be thought of as a last resort. If all you want to do is to enable a single program to run from the command-line, consider App Paths (in @Kim's answer below) instead.
Justin Grant
A: 

There is no registration, your program .bat, .exe must be within the system path.

If you right-click on "My Computer" ->"Properties"-> "Advanced" then go to the "System Variable". You can edit the "Path" variable to include the location of your executable.

Tony Borf
A: 

This has nothing to do with "registering" a program. Windows uses the current value of your PATH environment variable, and any executables found in those directories can be executed by simply typing the name into the Windows "Run" box (or command prompt, or anything else that launches executables).

Some programs add their directories to the PATH, others drop an executable (or even a batch file) into a well-known directory that is already part of the PATH, such as the Windows directory.

Adam Batkin
A: 

Add the program's path to your PATH variable.

If you want to do it programmaticly, you can edit (append, not just set) this registry location (in, say, your installer):

HLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path
Michael Petrotta
+4  A: 

Besides the system path, there's also the App Paths in the registry. Visual Studio, for example, doesn't have its main app (devenv.exe) in the PATH, but you can still launch it from the Run dialog.

Available names are enumerated under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths, with corresponding launch paths as values under each name.

See http://www.tweakxp.com/article36684.aspx for an example of how to add an exe to your App Paths.

Kim Gräsman