Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This is a very basic question, but I can't find an answer. I want to set an environment variable from the command prompt and then be able to access it globally (for instance, I should see it by going to system -> environment variables).

When I use the set command, it isn't accessible in a new cmd session.

set NEWVAR=SOMETHING
echo %NEWVAR%

Related questions:

share|improve this question
add comment

1 Answer

up vote 41 down vote accepted

To make the environment variable accessible globally you need to set it in the registry. As you've realised by just using:

set NEWVAR=SOMETHING

you are just setting it in the current process space.

According to this page you can use the setx command:

setx NEWVAR SOMETHING

setx is built into Windows 7, but for older versions may only be available if you install the Windows Resource Kit

share|improve this answer
5  
It turns out that setx is also built into windows 7. –  Shane Mar 25 '10 at 11:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.