SETing environmental variables permantly

  • Thread starter Thread starter yawnmoth
  • Start date Start date
Y

yawnmoth

Doing SET var="whatever" from the command line will result in %var%
only being equal to "whatever" in that window. How would I do it
permantly, from the command line?

Would I need to create some batch file that'd auto-append a SET
var="whatever" to c:\autoexec.bat, maybe?
 
From: "yawnmoth" <[email protected]>

| Doing SET var="whatever" from the command line will result in %var%
| only being equal to "whatever" in that window. How would I do it
| permantly, from the command line?
|
| Would I need to create some batch file that'd auto-append a SET
| var="whatever" to c:\autoexec.bat, maybe?

Settings --> control panel --> system --> advanced --> environmental variables
 
David said:
From: "yawnmoth" <[email protected]>

| Doing SET var="whatever" from the command line will result in %var%
| only being equal to "whatever" in that window. How would I do it
| permantly, from the command line?
|
| Would I need to create some batch file that'd auto-append a SET
| var="whatever" to c:\autoexec.bat, maybe?

Settings --> control panel --> system --> advanced --> environmental variables
That's not via the command line, as I had asked ;)

I want it to be do'able from the command line for the purposes of
automation. It's something I will probably be doing multiple times
over and if I could just type in "start" or something, that'd be a lot
easier than going through a bunch of mouse clicks and typing stuff in
when appropriate.
 
From: "yawnmoth" <[email protected]>


| That's not via the command line, as I had asked ;)
|
| I want it to be do'able from the command line for the purposes of
| automation. It's something I will probably be doing multiple times
| over and if I could just type in "start" or something, that'd be a lot
| easier than going through a bunch of mouse clicks and typing stuff in
| when appropriate.

You can't do it from a command line.

Anything you would do would be a daughter process and all child processes would inherit the
Environmental variables but the parent process won't. Thus you have to set the
Environmental variables in the OS such that they are loaded from the Registry in the parent
process and all daughter and child processes thus inherit the variables.

the same goes for Win9x/ME and that's why you set the variables in AUTOEXEC.BAT so all
daughter processes and child processes would inherit the Environmental variables. The
different in WinME vs. Win9x is that the OS parses AUTOEXEC.BAT for the SET commands and
then updates the Registry whiles Win9x actually interprets and sets all environmental
variables in AUTOEXEC.BAT.
 
yawnmoth said:
variables
That's not via the command line, as I had asked ;)

I want it to be do'able from the command line for the purposes of
automation. It's something I will probably be doing multiple times
over and if I could just type in "start" or something, that'd be a lot
easier than going through a bunch of mouse clicks and typing stuff in
when appropriate.

Here are a couple of ways of doing it:

setx.exe (Win2000 Resource Kit)
setenv.exe (ftp://barnyard.syr.edu/pub/vefatica/setenv.exe)

Note that any variable you set this way will be visible to
all processes launched subsequently but NOT to processes
the pre-exist.
 
Back
Top