how-does-the-run-dialog-know-where-applications-are-00

The Run Dialog can serve as an easy and very useful way to open programs on your computer, but just how does it know where those applications are located at on your system? Today’s SuperUser Q&A post has the answer to a curious reader’s question.

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

RELATED: How to Edit Your System PATH for Easy Command Line Access in Windows

The Question

SuperUser reader mt025 wants to know how the Run Dialog knows where applications are that aren’t in Windows’ system PATH:

As a power user, I frequently use the Run Dialog. I can understand why the following commands work, as they are in the PATH environment variable.

  • mspaint
  • diskmgmt.msc
  • explorer

These commands also work in CMD.

The commands below work in the Run Dialog, but they are not in the PATH environment variable, and they do not work in CMD.

  • firefox
  • winword
  • iexplore

How does Run know where these files are?

The Answer

SuperUser contributor w32sh has the answer for us:

When you execute a command from the Run Dialog, the system looks at the App Paths registry keys 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 is not found, it looks at each folder included in the PATH, whereas CMD (the Command Prompt) does not reference these registry keys, it only searches the PATH.


Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.