17

Possible Duplicate:
How do I set PATH and other environment variables?

How can one set the path permanently in command-prompt. I tried using the following code :-

set path=%path%;C:\python27

It works but only until the command prompt runs. When I exit and restart, the path returns to its earlier state.

Please tell me how can I set the command path permanently in Windows 7 command prompt.

4
  • The answers below are correct. What you did did not make the variable persistent.
    – KCotreau
    Commented Aug 1, 2011 at 12:46
  • 1
    @slhck: In general: Yes, you are right. However the other question was about all majors OS and thus the answer is really long. What this user was seeking is in one sentence in the last 1/3 of the answer and titled Windows NT. I'm not sure if a normal user knows that Windows 7 = NT 6.1.
    – Tex Hex
    Commented Aug 1, 2011 at 12:56
  • @TeX Actually it's in the first answer, in the part where it says Windows - GUI or Command Line.
    – slhck
    Commented Aug 1, 2011 at 13:00
  • @slhck:Woops, overlooked that. You are right. +1.
    – Tex Hex
    Commented Aug 1, 2011 at 13:03

2 Answers 2

12

From the Start Menu, right-click Computer on the right side. In the appearing window, select Advanced system settings in the left area - the System properties will appear. Select Environment Variables... at the bottom.

Change the Path variable there and it will be always active.

3
  • 19
    While this is the accepted answer, it doesn't explain how to do it from the command prompt. For reference, this is done using the setx command (as explained in the duplicated question linked above)
    – Luke
    Commented Jan 9, 2013 at 23:26
  • 6
    For further reference (as I keep coming back here whenever I need to do this), the command is setx path "%path%;c:\newpath" and this works without admin rights.
    – Luke
    Commented Feb 7, 2013 at 3:05
  • 2
    SystemPropertiesAdvanced.exe brings you to the menu to revise your path.
    – class
    Commented Feb 27, 2014 at 4:45
6

You need to do the following:

  1. Go to Control Panel --> System and Security --> System
  2. Click Advanced system settings
  3. Click Environment Variables
  4. In the System Variables area, locate the Path variable, highlight it and click Edit...
  5. Make the required changes, Click OK, OK, OK

That will save your changes permanently.

Not the answer you're looking for? Browse other questions tagged .