[Tutor] Re: How to change Windows Environment Variable

Ignacio Vazquez-Abrams ignacio@openservices.net
Thu, 30 Aug 2001 20:14:06 -0400 (EDT)

On Fri, 31 Aug 2001, ??? wrote:

> Dear all,
> How to change environment variable on Windows NT or 2000 by python?
> In Visual Basic case can setting as below:
> Private Declare Function GetEnvironmentVariable Lib "kernel32" _
>     Alias "GetEnvironmentVariableA" (ByVal lpName As String, _
>     ByVal lpBuffer As String, ByVal nSize As Long) As Long
> Private Declare Function SetEnvironmentVariable Lib "kernel32" _
>     Alias "SetEnvironmentVariableA" (ByVal lpName As String, _
>     ByVal lpValue As String) As Long
> I will waiting for good news.
> Thanks.
> MyeongKi Han

Good news:

There is a GetEnvironmentVariable() function in the win32api module.

Bad news:

There is no SetEnvironmentVariable() function.

Good news:

The source code for win32api is available via CVS
  (http://starship.python.net/crew/mhammond/cvs.html) so you can add the

Bad News:

You'll need Visual Studio 6 to compile it.

Ignacio Vazquez-Abrams  <ignacio@openservices.net>

ActivePython mailing list