PC Review


Reply
Thread Tools Rate Thread

Define Environment Variable

 
 
=?Utf-8?B?Sm9lIENsZXRjaGVy?=
Guest
Posts: n/a
 
      26th Oct 2007
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?
 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      26th Oct 2007

"Joe Cletcher" <Oak Ridge National Laboratory> wrote in message
news:539A766D-9D79-40B3-9E35-(E-Mail Removed)...
>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.


 
Reply With Quote
 
3c273
Guest
Posts: n/a
 
      26th Oct 2007
Use setx, available here:
http://www.microsoft.com/downloads/d...DisplayLang=en
Louis

"Joe Cletcher" <Oak Ridge National Laboratory> wrote in message
news:539A766D-9D79-40B3-9E35-(E-Mail Removed)...
> 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?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Define Variable Name using VBA GTReferee Microsoft Excel Misc 2 21st Jan 2009 06:37 PM
RE: Define a Variable Jim Thomlinson Microsoft Excel Programming 0 18th Jun 2008 08:22 PM
How to define variable kishore Microsoft Excel Programming 3 13th May 2005 10:22 AM
Environment variable inside an environment variable murdo Microsoft Windows 2000 CMD Promt 7 25th Feb 2005 06:11 PM
Urgent: Creating an Environment Variable (System Variable)? =?Utf-8?B?U2F1cmFiaA==?= Microsoft Dot NET Framework 1 7th Feb 2005 05:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:58 PM.