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.

Pankaj Upadhyay
  • 640
  • 1
  • 10
  • 17
  • The answers below are correct. What you did did not make the variable persistent. – KCotreau Aug 01 '11 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 Aug 01 '11 at 12:56
  • @TeX Actually it's in the first answer, in the part where it says *Windows - GUI* or *Command Line*. – slhck Aug 01 '11 at 13:00
  • @slhck:Woops, overlooked that. You are right. +1. – Tex Hex Aug 01 '11 at 13:03

2 Answers2

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.

Tex Hex
  • 2,402
  • 16
  • 25
  • 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 Jan 09 '13 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 Feb 07 '13 at 03:05
  • 2
    `SystemPropertiesAdvanced.exe` brings you to the menu to revise your path. – class Feb 27 '14 at 04: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.

Mike Insch
  • 2,621
  • 17
  • 9