PATH

Displays or sets the search path for executable files.

PATH [drive:]path[;...][;%PATH%]

Where:

  • [drive:]path - Specifies the directory to be included in the PATH environment variable.
  • ;... - Specifies additional directories to be included in the PATH environment variable.
  • ;%PATH% - Specifies that the specified directories are added to existing directories in the PATH environment variable.

Nothing would change if you wrote like this:

PATH [%PATH%;][drive:]path[;...]

since it would add the directories in the PATH environment variable after the existing ones. This is also fine:

PATH [drive:]path[;%PATH%][;...]

and endless other ways.

This is a "special" environment variable, in that it is also a command. This property also belongs to the DATEDATE and TIMETIME commands.

You can type PATH without any additional options to display search paths for executable files.

Finally, PATH ; deletes the PATH environment variable for the current CMD environment.

Examples:

1. Displays search paths for executable files (by expanding the PATH environment variable):

path

 

2. Set search paths for executable files (by setting the PATH environment variable) to C:\WINDOWS\system32\wbem and C:\WINDOWS:

path C:\WINDOWS\system32\wbem;C:\WINDOWS

 

3. Adds to the search paths for existing executable files (by adding to the PATH environment variable) the paths C:\die, C:\Program Files, and C:\Documents and Settings:

path C:\die;C:\Program Files;C:\Documents and Settings;%path%

or:

path %path%;C:\die;C:\Program Files;C:\Documents and Settings

Comments