My Own Private Idaho, er, Environ Var

May 6, 2009 at 10:46:30
Specs: Windows XP
How can I create my own DOS environment variable that is available system wide and stays persistent after the batch file that creates it finishes running?

See More: My Own Private Idaho, er, Environ Var

Report •


#1
May 6, 2009 at 12:27:53
set myvar=abc


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
May 6, 2009 at 13:58:50
Use the utility setx, which is not included in windows or use the gui - Control panel>(performance and maintenance for category view>) system>advanced>environment variables>new.

Report •

#3
May 6, 2009 at 20:40:59
Sorry, I forgot to say that I wish to create the environment variables via native DOS commands such as "set myVar=xyz" as suggested by M2 (I really want to avoid external add-ons such as setx as long as I can).

Also, I need to do this on the fly, so manual method involving GUI is not applicable here.

"set" looks good, but I'm not sure if "myVar" will stick around and visible to other batch files after the batch file that created "myVar" is finished and gone?


Report •

Related Solutions

#4
May 7, 2009 at 00:14:05
The vars set in a bet are available to later BATs --IF-- the runy in the same instance of command process. If you exit CMD the vars are gone.


=====================================
If at first you don't succeed, you're about average.

M2


Report •


Ask Question