Name

path

Synopsis

Set or display the command search path.

Syntax

path [path1][;path2][;path3][;...]

Description

When you type an executable filename at the command prompt (as opposed to an internal DOS command), Windows starts by looking in the current directory for a file that matches. If no matching file is found, Windows then looks in a series of other folders — these folders are known collectively as the path or the command search path.

The path statement is used to define additional directories to be included while searching for files. The path consists of a series of absolute directory pathnames, separated by semicolons. No spaces should follow each semicolon, and there should be no semicolon at the end of the statement. If no drive letter is specified, all pathnames are assumed to be on the boot drive.

Type path without any arguments to display the current command search path. The default path in Windows XP is c:\windows\system32;c:\windows;c:\windows\system32\wbem.

When you type the name of a command, DOS looks first in the current directory, and then in each successive directory specified in the path. Within each directory, it will look for executable files by their extension in the following order: .com, .exe, .bat. Windows searches your path for certain other file types (i.e., .dll or .ocx) as well, although most cannot be executed from the command line (see Notes for more information).

Examples

Specify the directories c:\Stuff and d:\Tools in the path:

C:\>path c:\stuff;d:\tools ...

Get Windows XP in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.