Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
Why am I able to execute a program that is not in my PATH environment variable?

I was teaching a coworker about %PATH% and found that if I run "Firefox", it works, but was surprised to see that it was not in my path.

What am I missing?

share|improve this question

marked as duplicate by Oliver Salzburg Jul 26 '12 at 19:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2  
It 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 Jul 25 '12 at 13:20
    
Thanks boot13, I was not aware of the App Paths registry keys. –  Mathew Jul 25 '12 at 13:30

1 Answer 1

up vote 98 down vote accepted

If you're trying to run an executable by only specifying its name, Windows looks for the file in the following locations:

  1. The current working directory.
  2. The Windows directory only (no subdirectories are searched).
  3. The Windows\System32 directory.
  4. Directories listed in the PATH environment variable.
  5. 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.

share|improve this answer
3  
One of the best answers to a question I've ever seen. +1 –  Everett Jul 25 '12 at 13:19
    
That was it, thank you sir. Learn something new everyday. –  Mathew Jul 25 '12 at 13:28
8  
@Mathew You're welcome. Keep in mind that the "App Paths" subkey also exists in the HKCU hive for applications that were installed for one user only. –  JC2k8 Jul 25 '12 at 13:36
1  
So that's why I never really had to muck around with the PATH until I went from .NET development to Java development. I never really considered why everything in .NET development "just works"! –  Stephen Swensen Jul 25 '12 at 18:59
2  
This is only true for the Windows Run dialog, in cmd.exe and powershell only 1. through 4. are used, see also boot13's comment. –  Alexander Jul 26 '12 at 12:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.