Path Command to set the PATH of evnironment variable.
Path Command will add the path to environment variable which system used to search for executable files. When we run a command without providing a command location it first search at the location set to environment variable.
Syntax
Path Pathname
Path ;
Path
Parameters.
Pathname | Specifies the drive and directory to set the path |
; | Specifies Separates directories |
%path% | Specifies Windows XP to append the command path to the existing set of directories listed in the PATH environment variable. |
Example…
Path command will add Temp directory to look in for executable file and will remove existing paths to the current command prompt only.
Path C:\Temp
This below path command will clear the path to the current command prompt.
Path ;
Merge C:\temp path including the path already added.
Path = %path%; C:\temp
When you include %path% in the syntax, Cmd.exe replaces it with the command path value found in the PATH variable
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 have Inventory.Exe to create network inventory, Inventory.bat to create Disk inventory in your network.
Operating system searches for a file in the following order: .exe, .com, .bat, and .cmd..