• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

How to change PERMANENTLY environment variables from batch script?

C

Cindy Parker

Flightless Bird
Ok, I know. In a batch file I can change environment variables temporarily (=for the
current, remaining session) be entering e.g.

set CLASSPATH=D:/newpath;%CLASSPATH%

However these changes are not visible outside of the current session and furthermore they
are lost after a reboot.

Is there a(nother) way to change them PERMANENTLY from batch script?

I can imagine that there is a way by a regedit or VisualBasic script or 3rd party cmdline tool.

Again: I don't want to edit them manually e.g. in the "System" dialog in control panel.
The change should take place on cmdline from a script

Cindy
 
R

Ramu Soft

Flightless Bird
Try setx.exe

You can try setting env variable using setx.exe(a windows 2000 resource kit utility)

http://ss64.com/nt/setx.html

Alternate is to set the values directly in env variable registry key(HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment). If you have plans to use this alternate, test it well before you deploy it in large scale.

Hope this helps...





cyp wrote:

How to change PERMANENTLY environment variables from batch script?
20-May-10

Ok, I know. In a batch file I can change environment variables temporarily (=for the
current, remaining session) be entering e.g.

set CLASSPATH=D:/newpath;%CLASSPATH%

However these changes are not visible outside of the current session and furthermore they
are lost after a reboot.

Is there a(nother) way to change them PERMANENTLY from batch script?

I can imagine that there is a way by a regedit or VisualBasic script or 3rd party cmdline tool.

Again: I do not want to edit them manually e.g. in the "System" dialog in control panel.
The change should take place on cmdline from a script

Cindy

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
WPF Report Engine, Part 4
http://www.eggheadcafe.com/tutorial...45-8b37cb7f3186/wpf-report-engine-part-4.aspx
 
T

Tom Willett

Flightless Bird
Re: Try setx.exe

Egghead Hooplehead alert. Changing the subject again to confuse people so
they wouldn't know to look at this thread for an answer to their original
question.

<Ramu Soft> wrote in message news:201052111441techibee.author@gmail.com...
: You can try setting env variable using setx.exe(a windows 2000 resource
kit utility)
:
: http://ss64.com/nt/setx.html
:
: Alternate is to set the values directly in env variable registry
key(HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment). If
you have plans to use this alternate, test it well before you deploy it in
large scale.
:
: Hope this helps...
:
:
:
:
:
: cyp wrote:
:
: How to change PERMANENTLY environment variables from batch script?
: 20-May-10
:
: Ok, I know. In a batch file I can change environment variables temporarily
(=for the
: current, remaining session) be entering e.g.
:
: set CLASSPATH=D:/newpath;%CLASSPATH%
:
: However these changes are not visible outside of the current session and
furthermore they
: are lost after a reboot.
:
: Is there a(nother) way to change them PERMANENTLY from batch script?
:
: I can imagine that there is a way by a regedit or VisualBasic script or
3rd party cmdline tool.
:
: Again: I do not want to edit them manually e.g. in the "System" dialog in
control panel.
: The change should take place on cmdline from a script
:
: Cindy
:
: Previous Posts In This Thread:
:
:
: Submitted via EggHeadCafe - Software Developer Portal of Choice
: WPF Report Engine, Part 4
:
http://www.eggheadcafe.com/tutorial...45-8b37cb7f3186/wpf-report-engine-part-4.aspx
 
B

Billns

Flightless Bird
Re: Try setx.exe

On 5/21/2010 8:50 AM, Tom Willett wrote:
> Egghead Hooplehead alert. Changing the subject again to confuse people so
> they wouldn't know to look at this thread for an answer to their original
> question.
>
> <Ramu Soft> wrote in message news:201052111441techibee.author@gmail.com...
> : You can try setting env variable using setx.exe(a windows 2000 resource
> kit utility)
> :
> : http://ss64.com/nt/setx.html
> :
> : Alternate is to set the values directly in env variable registry
> key(HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment). If
> you have plans to use this alternate, test it well before you deploy it in
> large scale.
> :
> : Hope this helps...
> :
> :
> :
> :
> :
> : cyp wrote:
> :
> : How to change PERMANENTLY environment variables from batch script?
> : 20-May-10
> :
> : Ok, I know. In a batch file I can change environment variables temporarily
> (=for the
> : current, remaining session) be entering e.g.
> :
> : set CLASSPATH=D:/newpath;%CLASSPATH%
> :
> : However these changes are not visible outside of the current session and
> furthermore they
> : are lost after a reboot.
> :
> : Is there a(nother) way to change them PERMANENTLY from batch script?
> :
> : I can imagine that there is a way by a regedit or VisualBasic script or
> 3rd party cmdline tool.
> :
> : Again: I do not want to edit them manually e.g. in the "System" dialog in
> control panel.
> : The change should take place on cmdline from a script
> :
> : Cindy
> :
> : Previous Posts In This Thread:
> :
> :
> : Submitted via EggHeadCafe - Software Developer Portal of Choice
> : WPF Report Engine, Part 4
> :
> http://www.eggheadcafe.com/tutorial...45-8b37cb7f3186/wpf-report-engine-part-4.aspx
>
>

Thunderbird, at least, seems to be able to keep this thread together
despite the name change in the subject line. I agree, though, that
posters shouldn't change the subject line.

Besides the setx suggestion the OP could run the batch file at startup
every time, although that's not what he asked.

Bill
 
Top