B
beaker
Hi,
This may be slightly OT, but as I'm using VB.NET I'll ask anyway...
I'm trying to update my path using the following code to tweak the registry
Dim regKey As RegistryKey
regKey = Registry.CurrentUser.OpenSubKey("Environment", True)
Dim s As String = CType(regKey.GetValue("Path"), String)
s = s & ";" & TextBox1.Text
regKey.SetValue("Path", s)
regKey.Close()
Which seems to work, in that the registry is updated correctly (checked
with regedit) and my user path seems to have been updated (checked with
right click on my computer, advanced, environment variables...)
My problem is that the actual path doesn't seem to have been updated in
practice (checked by typing 'path' on command line - new folder not
added, and using Environment.GetVariables("path") from within my
application).
Why does this discrepancy occur, and how do I fix it?
Many thanks,
Gary
This may be slightly OT, but as I'm using VB.NET I'll ask anyway...
I'm trying to update my path using the following code to tweak the registry
Dim regKey As RegistryKey
regKey = Registry.CurrentUser.OpenSubKey("Environment", True)
Dim s As String = CType(regKey.GetValue("Path"), String)
s = s & ";" & TextBox1.Text
regKey.SetValue("Path", s)
regKey.Close()
Which seems to work, in that the registry is updated correctly (checked
with regedit) and my user path seems to have been updated (checked with
right click on my computer, advanced, environment variables...)
My problem is that the actual path doesn't seem to have been updated in
practice (checked by typing 'path' on command line - new folder not
added, and using Environment.GetVariables("path") from within my
application).
Why does this discrepancy occur, and how do I fix it?
Many thanks,
Gary