PDA

View Full Version : DOS set PATH command


mazeltov
Jan 5, 2007, 10:34 PM
I used set PATH command to set the path as set PATH=c:/TC;and it works well
However,some users adds %PATH% after it, what does it imply

dmatos
Jan 5, 2007, 10:59 PM
You can have multiple PATHs set at a single time. By saying:

set PATH=c:/TC;

the only path set is c:/TC. If you say:

set PATH=c:/TC;%PATH%

You are setting the path to c:/TC as well as all previous values of PATH. The percent signs denote an environment variable, which will be expanded to it's contents when the command is run. For example, say I type the following:

set PATH=c:/bar;
set PATH=c:/foo;%PATH%
PATH
> c:/foo;c:/bar
set PATH=c:/foo;
PATH
> c:/foo;

Make sense? You use this if you don't want to eliminate all of the other valid paths while setting a new one as well.

francisdt
Jan 13, 2010, 07:23 AM
Awesome explanation