Export (0) Print
Expand All
Arp
At
Cls
Cmd
Fc
For
Ftp
If
Lpq
Lpr
Mmc
Rcp
Reg
Rem
Rsh
Rsm
SC
Set
Ver
Vol
Expand Minimize
12 out of 31 rated this helpful - Rate this topic

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%   : Specifies Windows XP to append the command path to the existing set of directories listed in the PATH environment variable.

/?   : Displays help at the command prompt.

Remarks

  • Using ; 

    When used as the only parameter, ; deletes the existing command path value found in the PATH variable.

  • Using %path% 

    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.

  • Current directory

    The operating system always searches in the current directory first, before it searches the directories in the command path.

  • Files with the same name, different extensions

    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 system to the accounting system network.

    The operating system 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.

  • Two or more identical file names in the path

    If you have two or more files in the command path that have the same file name and extension, Windows XP 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.

  • Searching the MS-DOS subsystem

    If you place the path command in your Autoexec.nt file, it automatically appends the specified MS-DOS subsystem search path to the Windows XP 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 specifies that Windows XP is to search 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

Command-line reference A-Z

Command shell overview

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.