I want to make a batch file for setting the %PATH% environment variable permanently - ie adding a value to the path permanently (in Windows XP).
+4
A:
On more recent OSes you can use setx
which allows pretty fine-grained control as for where the variables are stored. Not available on XP, though, unless you install the Windows Server 2003 Support Tools.
Joey
2009-11-05 06:43:41
sir i want to make a batch file for the same..
prateek
2009-11-05 06:58:50
A:
My-Computer - Properties, Advanced system settings -> environment variables. Set it there. (I hope that I got the right path here)
Dani
2009-11-05 06:44:05
you are missing a right-click (people will double-click on my computer by default) and the tab is named "advanced". another way: start menu/control panel/system then advanced/environment variables. of course this works only if the user uses classic view in the control panel...
Adrien Plisson
2009-11-05 07:36:02
COuld you anser me how to optain exactly the result you describe in your answer, but doing it from a script file?
Jesper Rønn-Jensen
2010-05-06 09:01:42
A:
You can use setx.exe to set environment variables from a batch file or command line. I believe it's included with Vista and 7. For XP, you can find it in the SP2 Support Tools.
Joel Baker
2009-11-05 07:12:36
A:
you can use vbscript (or command line reg) to change the PATH environment variable
eg vbscript
Set WshShell = WScript.CreateObject("WScript.Shell")
strReg = "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path"
strSetting = WshShell.RegRead(strReg)
strNewSetting = strSetting&";c\test" 'insert path to current PATH
WScript.Echo strNewSetting
WshShell.RegWrite strReg, strNewSetting
ghostdog74
2009-11-05 08:55:20