Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What are the "sources" where command line in windows (xp in my instance) is looking for commands to execute? I mean I write for example "java" in command line and then it run java.exe which is found in some directory listed in sytem/evnironment property PATH (you can list or set it by "SET PATH" command). Is there any other source for this lookup? If yes - where? and how can I set it?

I am asking because I have case where the command doesn't seem to be in any of that PATH's directories and despite of this it run that command (from somewhere..).

Thank you a lot.

share|improve this question
up vote 3 down vote accepted

According to MSDN documentation for CreateProcess that is in the end called to start application

  1. The directory from which the application loaded.
  2. The current directory for the parent process.
  3. The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
  4. The 16-bit Windows system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.
  5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
  6. The directories that are listed in the PATH environment variable. Note that this function does not search the per-application path specified by the App Paths registry key. To include this per-application path in the search sequence, use the ShellExecute function.

Regarding point 6. documentation for ShellExecute function doesn't describe when App Paths key is processed.

share|improve this answer

In addition to the PATH variable, specific app paths may be configured in the registry.

If you take a look at HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths, you can see how this is done.

share|improve this answer

The system's path. echo %PATH% should show it, from memory.

share|improve this answer
Alternatively, "set PATH" will also echo the value of %PATH%, and so will "set PAT", "set PA" etc – nray Jun 22 '09 at 18:32

I have found that I can set this path by going to My Computer Properties->Advanced->Environment Variables.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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