Indicates which directories the operating system should search for executable files.
The operating system uses the PATH command to search for executable files in the directories you specify in the %PATH% environment variable. By default, the search path is the current directory only.
PATH [[%PATH%] [drive:]path[;...]]
Display current search path:
Clear all search-path settings other than the default setting (the current directory):
For information about setting a search path for data files, see
the APPEND command.
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.
The operating system always searches in the current directory first, before it searches directories in the search path.
The maximum length of the PATH command is 127 characters. To fit more directories in the search path, you can shorten directory names, use the SUBST redirect directories to logical drives (which shortens the entries on the PATH command-line), or use the APPEND /X:ON command.
v6.0 and v6.2: PATH Not Limited to 128 Characters. For more information, see Microsoft Q97
You might have some files in the same directory that share the same filename 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 filename extensions in the order of precedence: .COM, .EXE, and .BAT. To run ACCNT.BAT when ACCNT.COM exists in the same directory, you must include the .BAT extension on the command-line.
You might have two or more files in the search path that have the same filename and extension. The operating system searches for the specified filename first in the current directory. Then it searches directories in the order in which they are listed in the PATH command.
To specify more than one path for the operating system to search, separate entries with a semicolon (;).
If you place the PATH command in your AUTOEXEC.BAT file, the operating system automatically initiates the specified search path every time you start your computer.
This command specifies that the operating system is to search three directories to find commands (the three paths for these directories are C:\USER\TAXES, B:\USER\INVEST, and B:\BIN):
A batch example. Specifies that the operating system is to search in the order: folder_3 + folder_2 + folder_1 + same as above.
PATH C:\USER\TAXES;B:\USER\INVEST;B:\BIN SET path=..\;..\..\;%PATH% CD \FOLDER_1\FOLDER_2\FOLDER_3