SEARCH

How-To Geek

How to Edit Your System PATH for Easy Command Line Access

image

Have you ever wondered why you can just type ipconfig into a command prompt and it works, but when you want to use a command line program you downloaded you have to navigate to its directory? Here’s how to fix that.

Adding a Folder To Your PATH

Open Computer and right-click on any white space, then select properties from the context menu.

image

When the System section of Control Panel opens, click on the Advanced system settings hyperlink in the left hand pane.

image

Then you will need to click on the Environment Variables button.

image

The variable we are looking for is a System variable called Path, once you have found it, click on the edit button.

image

In order to add an entry to your path, you need to precede the folder name with a semi-colon. For example, if i want to add the How-To Geek folder which is on the root of my C drive to my path i would the following to the end of the Variable value field:

;C:\How-To Geek

image

Now i can access any content within the How-To Geek folder without having to drill down into the directory.

image

Taylor Gibb is a Microsoft MVP and all round geek, he loves everything from Windows 8 to Windows Server 2012 and even C# and PowerShell. You can also follow him on Google+

  • Published 07/14/12

Comments (8)

  1. Nathan J.

    Wow, are you guys for real? ;)

    I did this ~15 years ago on a machine that ran DOS 5. I hacked the hell out of the AUTOEXEC.BAT file. PATH and PROMPT both. Especially PROMPT. IIRC, my prompt looked something like this:


    It is 04:07 on Saturday, 14 July 2012
    What is thy bidding, my master?
    PATH>

    Lots of fun.

    A similar trick I employed in Win95 was, I made a folder with a bunch of shortcuts to my apps, with 1-3 letter names, and I hid the file somewhere and added it to PATH, and printed out a list of the names and what they would open. My “launcher” was Win+R, code, Enter. I know Launchy can replicate that, sort of, but I don’t really care for the style anymore.

    Cool article. Brought me back some.

  2. r

    DOS 5.1 & PC Shell memories

  3. datatoo

    Why have they never fixed the dialog box, so you can actually see the path when you are trying to edit it?It is easier to copy the whole path string elsewhere, edit it and paste it back, than to use the tiny texbox provided

  4. Wayne Riker

    Need to re-state this every so often as the next generation is getting into computing. Too often it is assumed that everyone already knows this by virtue of it being around for 15 years.

    Many shortcuts that existed for two decades are still relevant, but useless if the knowledge isn’t passed on.

  5. Wayne Riker

    One item of note: a single path is still limited to 260 characters. I’ve heard of examples where this was exceeded because of long folder names along with deep nesting. Path command itself is limited to 8191 characters, a command prompt limitation not usually reached. See-http://support.microsoft.com/kb/830473

  6. Vaidya

    I am using winXP. When I tried, none of the windows shown in your article appeared. Still I proceeded to click on advanced, for whatever windows were opened, from DeskTop or File Explorer. Presently I am editing config.nt from dos window. Is there any alternative to this.

  7. Steve

    One of my customizations is always to make a C:\Bat directory/folder and then to include it in my Path statement.

    Then, as needed, I can write a short batch file (program) to:

    1 Change to correct drive.
    2 Change to correct directory/folder.
    3 Launch desired program.

    Since I’ve already added C:\Bat to the Path statement (using minimum # of characters), I don’t need to go back and edit the Path statement for each program I may want to use.

    Back in the day, I used to get a lot of mileage using ANSI.SYS not only for color, but also to re-program some of the F-keys to print out the name of a DOSKEY macro (for short batch files) and also to hit the Enter key to execute it. Nowadays, I use TCC/LE from JPSoft to try and get some of that functionality at the command prompt.

    So, instead of adding multiple program directories to the Path statement, just add one for your batch files. Then you can put multiple batch files in the PATH environment, without having to keep changing the Path statement.

  8. EL

    Question: Is there a way to set it so that I don’t have to type .lnk at the end of my shortcuts that are in the path folder? IE: like the way you don’t have to type .exe at the end of exe files to run them?

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!