If you're trying to run an executable by only specifying its name, Windows looks for the file in the following locations:
- The current working directory.
- The
Windows directory only (no subdirectories are searched).
- The
Windows\System32 directory.
- Directories listed in the PATH environment variable.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths (also HKEY_CURRENT_USER since Windows 7)
Microsoft actually recommends "registering" applications in the App Paths subkey to avoid the need for applications to modify the system PATH environment variable. The application's installer will register the executable.
2It depends on the context. If you're entering "firefox" from a command line, then firefox.exe must either be in the path or in the Windows or Windows\System32 folders. If you're entering "Firefox" in the Run dialog, the App Paths registry is used, so firefox.exe is registered there. – boot13 – 2012-07-25T13:20:51.353
Thanks boot13, I was not aware of the App Paths registry keys. – Mathew – 2012-07-25T13:30:00.793