The reason why you're probably never gonna see SetEnvironmentVariable in te
framework is due to the encouragement of utilizing config files as your
settings. Of course, we as developers can fight that by adding things back
in, but the focus has shifted from Environement Variables -> Registry ->
config files, and I think its a good change... its a whole lot easier to
shift config files around then it is to write a batch file or a "Reg Import"
when you want to duplicate or just move apps around.
--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/ er**@cc.ensoft-software.com [remove the first "CC."]
"Bill Davidson" <bi***********@getronics.com> wrote in message
news:uZ**************@TK2MSFTNGP10.phx.gbl...
Thanks,
Perhaps I'll just call the SetEnvironmentVariable() Win32 API via
P/Invoke. I just figured the Framework Class Libraries wrapped this call, but I just
couldn't find it.
Thanks for your help,
Bill
"Felix Wang" <v-*****@online.microsoft.com> wrote in message
news:UV**************@cpmsftngxa07.phx.gbl... Hi Bill,
Thanks for posting.
System environment variables are stored in the following key:
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Se ssion
Manager\Environment
User variables are stored in the following key:
HKEY_CURRENT_USER\Environment
Maybe we can use the Microsoft.Win32.Registry and the RegistryKey
classes to manipulate them directly.
I hope this makes sense to you.
Regards,
Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no
rights.