PC Review


Reply
Thread Tools Rate Thread

How to change/add environment variables from command line PERMANENTLY?

 
 
Sebastian Kaist
Guest
Posts: n/a
 
      1st Apr 2009
When I open a command prompt in WinXP and type

set FOOBAR=D:\test\project

then the env variable FOOBAR is set for this command prompt session (only !!) to the (new) value.
It is however NOT changed for the "global" environment of the whole machine.
To change it for the "global" machine I have always to go to

Control Panel->System->Advanced Tab->Environment Variable Button

and change it manually there.
This is very unconvenient.

Is there a way to change the "global" env variable values PERMANENTLY from command line/from batch script?

Maybe I have to change the Registry (where exactly) ?

Assume I want to change ONE path pattern in the PATH variable (not only add it).
Can I do this with a command similar to

CHANGEENVvalue.exe var=PATH "D:\myoldpath\" "D:\mynewpath\"

....and afterwards all path patterns are replaced permanently ?

Sebastian

 
Reply With Quote
 
 
 
 
Alister
Guest
Posts: n/a
 
      1st Apr 2009


"Sebastian Kaist" wrote:

> When I open a command prompt in WinXP and type
>
> set FOOBAR=D:\test\project
>
> then the env variable FOOBAR is set for this command prompt session (only !!) to the (new) value.
> It is however NOT changed for the "global" environment of the whole machine.
> To change it for the "global" machine I have always to go to
>
> Control Panel->System->Advanced Tab->Environment Variable Button
>
> and change it manually there.
> This is very unconvenient.
>
> Is there a way to change the "global" env variable values PERMANENTLY from command line/from batch script?
>
> Maybe I have to change the Registry (where exactly) ?
>
> Assume I want to change ONE path pattern in the PATH variable (not only add it).
> Can I do this with a command similar to
>
> CHANGEENVvalue.exe var=PATH "D:\myoldpath\" "D:\mynewpath\"
>
> ....and afterwards all path patterns are replaced permanently ?
>
> Sebastian
>


There is a tool in the Windows XP Service Pack 2 Support Tools named
setx.exe that allows you to change global Environment variables from the
command line.

Alister


 
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
How to change PERMANENTLY environment variables from batch script? Cindy Parker Windows XP General 3 21st May 2010 07:11 PM
How to change PERMANENTLY environment variables from batch script? Cindy Parker Windows XP Help 9 21st May 2010 06:00 AM
How to change/add environment variables from command line PERMANENTLY? Sebastian Kaist Windows XP Help 3 1st Apr 2009 01:16 PM
SET Command for global environment variables Andreas Klausing Microsoft Windows 2000 CMD Promt 3 29th Nov 2003 11:46 AM
RE: Location for all command-line environment variables =?Utf-8?B?QXVzdGluIE0uIEhvcnN0?= Microsoft Windows 2000 CMD Promt 0 25th Oct 2003 11:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:05 AM.