Enviornment Variables will not stick through CMD or Power Shell (even if I run them as admin)

#1
I have tried numerous times in both Command Prompt and Power Shell to set the Environment Variable for "Path" and it will not stick. I have tried running as admin as well.

If I test it in the open CMD or Powershell Window it seems to stick, but if I open a new window it is gone. If I go through System Properties and add it manually that way, it works just fine. Unfortunately I need it to work through a batch file or script.

I am running Windows 7 Pro 64-bit.

CMD code I have tried:
Code:
Set Path = C:\Program Files\Java\jdk1.7.0\bin;%Path%
Code:
Set Path = C:\Program Files\Java\jdk1.7.0\bin\;%Path%
Code:
Set Path = "C:\Program Files\Java\jdk1.7.0\bin";%Path%
Code:
Set Path = "C:\Program Files\Java\jdk1.7.0\bin\";%Path%
Power Shell code I have tried:
Code:
$Env:Path = $Env:Path + ";C:\Program Files\Java\jdk1.7.0\bin"
Code:
$Env:Path = $Env:Path + ";C:\Program Files\Java\jdk1.7.0\bin\"
 


This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.
Top