[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

Writing environment variables

Stephen Walch

10/25/2002 5:00:00 PM

What is the opposite of Environment.GetEnvironmentVariable()?

Seems like it should be obvious, but I am missing something.


2 Answers

NETMaster

10/25/2002 5:19:00 PM

0

.NET 1.0 has no method to set environment variables, do PInvoke:

[DllImport("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)]
public static extern bool SetEnvironmentVariable( string lpName, string lpValue );

Note, as always in Win32,
changed variables are only valid for the current process and its children.


--
Thomas Scheidegger - MVP .NET - 'NETMaster'
http://www.cetus-links.org/oo_d... - http://dnetm...



"Stephen Walch" <swalch@proposion.com> wrote in message news:eLx949DfCHA.1864@tkmsftngp11...
> What is the opposite of Environment.GetEnvironmentVariable()?
> Seems like it should be obvious, but I am missing something.


Manfred Braun

10/26/2002 1:35:00 AM

0

Hi All,

...... what not neccesaryly means, the are not permanent. With other
methods, WMI based methods for example, one can write directly into the
system-environment and each new started process inherits them.

Just a note.

Best regards,
Manfred Braun

(Private)
Mannheim
Germany

mailto:_manfred.braun_@berlin.de
(Remove the anti-spam-underscore to mail me!)

"Thomas Scheidegger [MVP] NETMaster" <spam.netmaster@swissonline.ch> wrote
in message news:OUroqIEfCHA.1748@tkmsftngp09...
> .NET 1.0 has no method to set environment variables, do PInvoke:
>
> [DllImport("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)]
> public static extern bool SetEnvironmentVariable( string lpName, string
lpValue );
>
> Note, as always in Win32,
> changed variables are only valid for the current process and its children.
>
>
> --
> Thomas Scheidegger - MVP .NET - 'NETMaster'
> http://www.cetus-links.org/oo_d... - http://dnetm...
>
>
>
> "Stephen Walch" <swalch@proposion.com> wrote in message
news:eLx949DfCHA.1864@tkmsftngp11...
> > What is the opposite of Environment.GetEnvironmentVariable()?
> > Seems like it should be obvious, but I am missing something.
>
>