2

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.

4 Answers 4

3

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.

3

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.

0

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

1
  • Alternatively, "set PATH" will also echo the value of %PATH%, and so will "set PAT", "set PA" etc
    – nray
    Jun 22, 2009 at 18:32
0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .