Windows "PATH" environment variable
When we type a command in windows terminal, it automatically searches the
PATH variables and if it could find a match, it'll execute it otherwise it'll display an error that couldn't find the command. All the locations that windows searches for the commands are listed in
PATH variables in the following location:
WIN + R / sysdm.cpl / Advanced Tab / Environment Variables / PATH
There are two sections here, one is "User Variables" and the other is "System Variables". Windows always checks the "System Variables" first and if it couldn't find anything on those folders it looks up on "User Variable" entries. It starts from top of the list so first entries have more priority.
Alternatively you can see all these variables by typing
SET command on terminal. If you take a look at the
PATH variable you can see that in that list system variables appear first and user variables appear at the end.
PowerShell command to display all environment variables is:
gci env:* | sort-object name
If you want to see where is the location of a binary command, use the following command: