# XP SETX Utility set global environment variable



## ComputerMuse (Dec 1, 2011)

i saw this *link* for questions on the *setx* command. Having just worked that out myself, i thought that i would share what i have learned. The OP has over 15,000 views at time of this writing, so there is much interest in this command and how it works.

the first question about rebooting, no it is not necessary to reboot. it just has to do with an understanding of what the *setx* command is doing at runtime. by running *setx* _variablename_ path, what you are doing is setting a global environment variable for all *future* dos windows but _not the current one!_

The solution for bobritter is to run the following command at runtime: *setx* _variablename_ path & *set* _variablename_=path. An example might be: *setx* _returnvalue_ %cd% & *set* _returnvalue_=%cd%

What this is doing is setting (via *setx*) all future environment variables as well as the local (via the *set* command) one too. This should fix the rebooting issue as well as answer squashman as to what the command is doing.

The *setx *command does lots of other things, type in *setx* by itself to display the help menu.

Hope that this helps out other users of this command. If anyone has other questions about this command, please ask away...

CM


----------



## Squashman (Apr 4, 2003)

Good job digging up a 4 1/2 year old thread. Of course it is going to have over 15,000 views after that amount of time. Half of those are probably just from Google Indexing this site a couple of times a day.

I did not question as to what the command was doing. I just didn't know SETx was a command. It is not native to XP itself until you install the Support Tools. I don't know too many people who bother to install the support tools.


----------

