Share via


Path

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Path

Sets the command path in the PATH environment variable, which is the set of directories used to search for executable files. Used without parameters, path displays the current command path.

Syntax

Path [[%path%] [Drive**:]Path [;**...]]

Parameters
  • [Drive:]Path
    Specifies the drive and directory to set in the command path.
  • ;
    Separates directories in the command path.
  • %path%
    Appends the command path to the existing set of directories listed in the PATH environment variable.
  • /?
    Displays help at the command prompt.
Remarks
  • When used as the only parameter, ; deletes the existing command path value found in the PATH variable.

  • When you include %path% in the syntax, Cmd.exe replaces it with the command path value found in the PATH variable, eliminating the need to manually enter these values at the command line. For more information about substituting environment variable values, see Command shell overview in Related Topics.

  • The current directory is always searched first, before the directories in the command path.

  • You might have some files in the same directory that share the same file name but have different extensions. For example, you might have a file named Accnt.com that starts an accounting program and another file named Accnt.bat that connects your server to the accounting system network.

    The Windows Server 2003 family searches for a file by using default file name extensions in the following order of precedence: .exe, .com, .bat, and .cmd. To run Accnt.bat when Accnt.com exists in the same directory, you must include the .bat extension at the command line.

  • If you have two or more files in the command path that have the same file name and extension, the Windows Server 2003 family searches for the specified file name first in the current directory, and then it searches the directories in the command path in the order in which they are listed in PATH.

  • If you place the path command in your Autoexec.nt file, the Windows Server 2003 family automatically appends the specified MS-DOS subsystem search path to the search path every time you log on to your computer. Cmd.exe does not use the Autoexec.nt file. When started from a shortcut, Cmd.exe inherits the environment variables set in My Computer/Properties/Advanced/Environment.

Examples

The following command searches three directories to find external commands. The three paths for these directories are C:\User\Taxes, B:\User\Invest, and B:\Bin:

path c:\user\taxes;b:\user\invest;b:\bin

Formatting legend

Format Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

See Also

Concepts

Command-line reference A-Z
Command shell overview