NT Syntax

PATH

Display or set a search path for executable files

syntax
      PATH pathname [;pathname] [;pathname] [;pathname]...
      PATH
      PATH ;
key
   pathname : drive letter and/or folder
    ;       : the command PATH; will clear the path

PATH without parameters will display the current path.

The %PATH% environment variable contains a list of folders. When a command is issued at the CMD prompt, the operating system will first look for an executable file in the current folder, if not found it will scan %PATH% to find it. Use the PATH command to display or change the list of folders stored in %PATH%.

To add items to the current path, include %PATH% in your new setting.
For Example:

PATH=%PATH%;C:\Program Files\My Application

Permanent Changes

Changes made using the PATH command are NOT permanent, they apply to the current CMD prompt only and remain only until the CMD window is closed.

T o permanently change the PATH use

Control Panel, System, Environment, System Variables
Control Panel, System, Environment, User Variables

You can also do this at the command line with SETX

Changing a variable in the Control Panel will not affect any CMD prompt that is already open.
Only new CMD prompts will get the new setting.

To change a system variable you must have administrator rights

The %PATH% variable is set as both a system and user variable, the 2 values are combined to give the PATH for the currently logged in user. This is explained in full by MS Product Support Article Q100843

If your system has an AUTOEXEC.BAT file then any PATH setting in AUTOEXEC.BAT will also be appended to the %PATH% environment variable. This is to provide compatibility with old installation routines which need to set the PATH. All other commands in AUTOEXEC.BAT are ignored.

Terminology

For a file stored as:
C:\Program Files\Adobe\Acrobat.exe

The Path is:
\Program Files\Adobe\

The Drive is:
C:

The Filename is:
Acrobat.exe

The Pathname is:
\Program Files\Adobe\Acrobat.exe

The Full Pathname is
C:\Program Files\Adobe\Acrobat.exe

"If you do not love your job, change it. Instead of pushing paper, push ideas. Instead of sitting down, stand up and be heard. Instead of complaining, contribute. Don't get stuck in a job description" - Microsoft job advert

Related Commands:

SET - Display, set, or remove environment variables.

PATHMAN - This Resource Kit utility allows quick modification of both the system and user paths. Pathman can resolve many problems such as duplicate characters, and can improve performance by removing duplicate paths. For details see Pathman.wri in the resource kit.

Equivalent Linux BASH commands:

env - Display, set, or remove environment variables
CDPATH - Environment variable
MAILPATH - Environment variable
PATH - Environment variable



Simon Sheppard
SS64.com