How to change Windows Environment Variable

??? mkhan12 at kornet.net
Fri Aug 31 04:09:53 CEST 2001


Thanks quick reply. But not set to OS.
I would like to set and using while login windows.

>>>Import os
>>>os.environ['Test'] = 'Hello '
>>>print 'Test key in this?=', os.environ.has_key('Test') 
Test key in this?= 0

But VB case OK!

Please answer.


-----Original Message-----
From: Stephen Hansen [mailto:stephen at myseraph.org]
Sent: Friday, August 31, 2001 7:59 AM
To: ???
Subject: Re: How to change Windows Environment Variable

How about...

import os
os.environ['Variable'] = 'value'

--Stephen
http://www.myseraph.org/
----- Original Message -----
From: "???" <mkhan12 at kornet.net>
To: <python-list at python.org>; <activepython at listserv.ActiveState.com>;
<tutor at python.org>
Sent: Thursday, August 30, 2001 4:43 PM
Subject: How to change Windows Environment Variable


> 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



More information about the Python-list mailing list