Define Environment Variable

G

Guest

I tried to write a batch job that added an environment variable. However, the
environment variable only persists for the open "command window" that ran the
batch job.

How can I automate the addition of an environment variable?
 
P

Pegasus \(MVP\)

Joe Cletcher said:
I tried to write a batch job that added an environment variable. However,
the
environment variable only persists for the open "command window" that ran
the
batch job.

How can I automate the addition of an environment variable?

Every process you start inherits its variables from its
parent. Parents never inherit variables from their child
processes.

To set a variable permanently, you must set it in the
master environment. There are three ways to do this:
a) In the Control Panel / System / Advanced
b) With setx.exe (Windows Resource Kit)
c) With setenv.exe (ftp://barnyard.syr.edu/pub/vefatica/setenv.exe)

Note that in all cases, the variables in pre-existing processes
are NOT affected. Only processes launched after the change
will get the new variables.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top