IcyLime
IcyLime

Reputation: 41

How does the path environment variable work?

I know how to add values to the path variable, so my question is not how to use it.

Rather, I want to know how it works under the hood. When you type in the name of a program to execute, how does the system make use of PATH to find the matching program? How does it know when it finds a match?

Upvotes: 2

Views: 867

Answers (1)

Lance
Lance

Reputation: 86

for example... when you set c:\python27\ into your environment path... and you goto cmd, you are at c:\ and you type python cmd knows to check the environment path which it will find c:\python27\ among others. then it looks for the command in each path listed in your environment paths then executes the command if it finds it

simply the env path tells where to look for the command if it is not in the current directory

Upvotes: 3

Related Questions