Go Back   TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , ,

Sponsored Links



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

Windows XP Support


Reply
 
Thread Tools Search this Thread
  #1  
Old 01-04-2009
Sebastian Kaist
 
Posts: n/a
How to change/add environment variables from command line PERMANENTLY?

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
  #2  
Old 01-04-2009
Pegasus [MVP]
 
Posts: n/a
Re: How to change/add environment variables from command line PERMANENTLY?

After running the set command, run one of the following commands as well:
setx.exe (Win2000 Resource Kit)
Reply With Quote
  #3  
Old 01-04-2009
Alister
 
Posts: n/a
Re: How to change/add environment variables from command line PERMANENTLY?

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.
Reply With Quote
  #4  
Old 01-04-2009
Jose
 
Posts: n/a
Re: How to change/add environment variables from command linePERMANENTLY?

That is unconvenient.

I created a new FOOBAR variable for my user account through
CP...Advanced... and saved it.
I opened a new CMD window, ran "set" and the FOOBAR variable was
there, it was not before.
The change is permanent unless removed through CP.
I deleted the FOOBAR variable later from CP and it was then gone in a
new CMD window.

You can create/change variables by user or system wide.

I frequently make a system wide adjustment to add stuff to the end of
the PATH variable to make things easier for me later to keep me from
having to CD when in a DOS window. If you don't like the PATH, change
it. They don't call me DOS Boy for nothing.

Here is a link to some discussion that may help:
http://vlaurie.com/computers2/Articles/environment.htm

For more, use google for: dos window environment variable
Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to change/add environment variables from command line PERMANENTLY?"
Thread Thread Starter Forum Replies Last Post
Importance of Command Line User Environment in Linux aFRODITA Operating Systems 4 12-11-2010 07:31 AM
Is " CLUE" Command Line User Environment important aspect of linux Loyalpalm Operating Systems 5 11-11-2010 11:10 AM
Remove system environment variable using command line ? Vilius Mockûnas Windows Server Help 1 12-06-2009 04:10 PM
How to load/refresh environment variables WITHOUT leaving command prompt? David Welch Windows XP Support 3 15-05-2009 11:33 PM
change password by command line shopsoy Window 2000 Help 0 25-02-2008 09:18 PM


All times are GMT +5.5. The time now is 12:12 AM.