Display or set a search path for executable files
PATH pathname [;pathname] [;pathname] [;pathname]...
pathname : drive letter and/or folder
; : the command 'PATH ;' will clear the pathPATH without parameters will display the current path.
The %PATH% environment variable contains a list of folders. When a command is issued at the CMD prompt, the operating system will first look for an executable file in the current folder, if not found it will scan %PATH% to find it.
Use the PATH command to display or change the list of folders stored in the %PATH% environment variable.
To view each item on a single line use this batch script:
::echo the path one line at a time
for %%G in ("%path:;=" "%") do @echo %%G
To add items to the current path, include %PATH% in your new setting.
PATH=%PATH%;C:\Program Files\My Application
Changes made using the PATH command are NOT permanent, they apply to the current CMD prompt only and remain only until the CMD window is closed.
T o permanently change the PATH use
Control Panel, System, Environment, System Variables
Control Panel, System, Environment, User Variables
You can also do this at the command line with SETX
Changing a variable in the Control Panel will not affect any CMD prompt that is already open.
Only new CMD prompts will get the new setting.
To change a system variable you must have administrator rights
The %PATH% variable is set as both a system and user variable, the 2 values are combined to give the PATH for the currently logged in user. This is explained in full by MS Product Support Article Q100843
If your system has an AUTOEXEC.BAT file then any PATH setting in AUTOEXEC.BAT will also be appended to the %PATH% environment variable. This is to provide compatibility with old installation routines which need to set the PATH. All other commands in AUTOEXEC.BAT are ignored.
For a file stored as:
The Drive is:
The Filename is:
The Path is:
The Pathname is:
The Full Pathname is
About the Author
FortyPoundHead has posted a total of 1974 articles.
Comments On This Post
No comments on this post yet!
Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.
Or you can drop a note to the administrators if you're not sure where you should post.