Change environment setting path

B

bart.hernalsteen

Hi,
I want to read the envorinment setting "path" and then on certain
conditions change this setting.
ex path : "%SystemRoot%\system32;%SystemRoot%;%SystemRoot%
\System32\Wbem;C:\Program Files\Symantec\pcAnywhere\;"

I want to add some folders to the path and delete some.
But when i read the path all the system variables "ex. "%SystemRoot%\"
are converted to the exact folder
I store this in a string and change the string an then write to string
to the registry.
But i lose the "%SystemRoot%" variables in my path.

The registry key is a REG_EXPAND_SZ key
readValue = My.Computer.Registry.GetValue _
("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment", "Path", Nothing)

Some advice ?
 
K

kimiraikkonen

Hi,
I want to read the envorinment setting "path" and then on certain
conditions change this setting.
ex path : "%SystemRoot%\system32;%SystemRoot%;%SystemRoot%
\System32\Wbem;C:\Program Files\Symantec\pcAnywhere\;"

I want to add some folders to the path and delete some.
But when i read the path all the system variables "ex. "%SystemRoot%\"
are converted to the exact folder
I store this in a string and change the string an then write to string
to the registry.
But i lose the "%SystemRoot%" variables in my path.

The registry key is a REG_EXPAND_SZ key
readValue = My.Computer.Registry.GetValue _
        ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment", "Path", Nothing)

Some advice ?

Hi,
This may help in maintaining your code:
http://www.freevbcode.com/ShowCode.asp?ID=8293

HTH,

Onur
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top