|
| |||||||||
| Tags: command, command prompt, variables |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| 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 |
|
#2
| |||
| |||
| 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) |
|
#3
| |||
| |||
| 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. |
|
#4
| |||
| |||
| 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 |
![]() |
|
| Thread Tools | Search this Thread |
| |
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 |