Posted On 2006-11-27 by FortyPoundHead
Keywords: Command Reference PATH
Tags: Windows Commandline Tutorial Windows
Views: 1470


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 off
::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.
For Example:

PATH=%PATH%;C:\Program Files\My Application

Permanent Changes

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:
C:\Program Files\Adobe\Acrobat.exe

The Drive is:

The Filename is:

The Path is:
\Program Files\Adobe\

The Pathname is:
\Program Files\Adobe\Acrobat.exe

The Full Pathname is
C:\Program Files\Adobe\Acrobat.exe

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.

Your IP address is:

Before you can post, you need to prove you are human. If you log in, this test goes away.

Recent Forum Posts

List of Shady Characters
dwirch posted on April 25, 2017 at about 16:39 in Webmaster Stuff

Job Spammer: Bilal Uddin
dwirch posted on April 25, 2017 at about 11:00 in Spammers

Bug Fix: Contact Form Error
dwirch posted on April 21, 2017 at about 11:38 in Site News

Bug Fix: Ophion Time Tracker
dwirch posted on April 9, 2017 at about 11:30 in Site News

Job Spammer: Yogesh Kapadne
dwirch posted on March 31, 2017 at about 8:04 in Spammers

Job Spammer: Sathya Narayana
dwirch posted on March 15, 2017 at about 7:18 in Spammers