On Thu, 17 Mar 2005 09:10:36 -0500, Jerold Schulman <(E-Mail Removed)>
wrote:
>On 16 Mar 2005 09:35:47 -0800, (E-Mail Removed) wrote:
>
>>Hi,
>>
>>I am wondering how can I append path to existing path in the registry.
>>I want to add d:\tools for the PATH variable in
>>[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
>>Manager\Environment]
>>
>>
>>Thanks.
>
>See tips 4263 and 8840 in the 'Tips & Tricks' at http://www.jsiinc.com
>
>Jerold Schulman
>Windows Server MVP
>JSI, Inc.
>http://www.jsiinc.com
I did it an ugly way but effective. I used vbscript to capture the
contents of the current value. I then appended the new value to it and
wrote it back
'************************************************************
'* Modifying The System Path With New Entries *
'************************************************************
Dim ExistingPath, NewPath
Set oShell = WScript.CreateObject("WScript.Shell")
Set oEnv = oShell.Environment("SYSTEM")
'************************************************************
'* Add your Path Entry Here *
'************************************************************
ExistingPath = oEnv("PATH")
NewPath = ExistingPath & ";" & "C:\ADD SOME PATH HERE"
oEnv("PATH") = NewPath 'WRITE NEW PATH, INCLUDING OLD ONE