Environment Variable not sticking

I've recently shifted back to Windows 7 and am trying to use Renderman's shader compiler. It requires that RMANTREE be set to

C:\Program Files\Pixar]RendermanStudio-3.0.3-maya2012\rmantree

So I had set up my mac terminal to have that as an environment variable and never needed to set it again.

On Windows, I can get it to set RMANTREE but I have to do it in every command prompt. I tried adding it to the system environment variables but if I were then to

echo %RMANTREE%, I only get %RMANTREE% back instead of the correct path.

Probably a stupid question, but any ideas? It would just save a little bit of time, but even a little bit is awesome.


Solution 1:

You need to set a persistent User or System-wide environment variable.

To set the variable permanently for your user, use setx from a command prompt:

setx RMANTREE "C:\Program Files\Pixar]RendermanStudio-3.0.3-maya2012\rmantree"

To set the variable permanently for the entire system, add the /m switch:

setx /m RMANTREE "C:\Program Files\Pixar]RendermanStudio-3.0.3-maya2012\rmantree"

You can check if a specific environment variable is sourced by using the set (no "x"):

set RMANTREE

Or check all variables starting with a given letter:

set R

And no, it's not a stupid question.

edit: The change to the variable will show in all future CMD windows; NOT in the current CMD window.