How does the Run dialog know where applications are?
When you execute a command from Run dialog, the system looks at the App Paths
registry key here:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
and
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
EXAMPLE
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\filezilla.exe
(default)
value data has the full path to the executable.
If it's not found, it looks at each folder included in the PATH.
Whereas the Command Prompt doesn't reference these registry keys. It only searches the PATH.
w32sh's answer correctly points out that the extra keys searched by the Run dialog are here:
- HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
There is official documentation for these paths.
An important fact about these keys is that the name of the key (e.g. "filezilla.exe") doesn't have to match the full path in any way. Under Windows 7, the value can even be a simple command-line, similar to what can be used as the "target" of a shortcut.
For instance, I used to have this in my registry:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\jedit.exe]
@="\"C:\\WINDOWS\\system32\\javaw.exe\" -Xms24M -Xmx512M -jar \"C:\\Program Files\\jEdit\\jedit.jar\" -reuseview"
I can't seem to make this work in Windows 10, but you can still point at any file, including a batch file, e.g.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\jedit.exe]
@="C:\\Program Files\\jEdit\\run-jedit.bat"
That allows you to type "jedit" or "jedit C:\foo\bar\something.txt" to run the JVM with appropriate options and launch/reuse jEdit.
As far as I can see, the key name must end in ".exe", so to create an alias of "abc", you create a key "abc.exe", even if it's not pointing to a ".exe" file.