By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,290 Members | 1,195 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,290 IT Pros & Developers. It's quick & easy.

Change environment setting path

P: n/a
Hi,
I want to read the envorinment setting "path" and then on certain
conditions change this setting.
ex path : "%SystemRoot%\system32;%SystemRoot%;%SystemRoo t%
\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\Cont rol\Session
Manager\Environment", "Path", Nothing)

Some advice ?

Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Apr 17, 10:33*pm, bart.hernalst...@gmail.com wrote:
Hi,
I want to read the envorinment setting "path" and then on certain
conditions change this setting.
ex path : "%SystemRoot%\system32;%SystemRoot%;%SystemRoo t%
\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\Cont rol\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
Jun 27 '08 #2

P: n/a
On 17 apr, 22:15, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Apr 17, 10:33*pm, bart.hernalst...@gmail.com wrote:


Hi,
I want to read the envorinment setting "path" and then on certain
conditions change this setting.
ex path : "%SystemRoot%\system32;%SystemRoot%;%SystemRoo t%
\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\Cont rol\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- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -
Hi,
My code is working.
I don't think i would have found this without your help
Thank you very much
Bart
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.