Set Windows Environment Variable

Fuzzyman fuzzyman at gmail.com
Thu Mar 30 11:58:56 EST 2006


Magnus Lycka wrote:
> Duncan Booth wrote:
> > Fuzzyman wrote:
> >> In the ``win32api`` package there is a ``GetEnvironmentVariable``
> >> function, but no ``SetEnvironmentVariable``. Any options ?
> >
> > No, your only option is to find a solution which doesn't involve changing
> > another process's environment.
>
> Surely there must be a way to programatically set up the
> environment variables for not yet started processes? I.e.
> doing the same as when you manually change things in the
> control panel. I'm pretty sure many Windows installers do
> that, and while I suppose this is technically a registry
> manipulation, I suspect there is a more direct API somewhere.

I *believe* that ``SetEnvironmentVariable`` exists in the underlying
windows API, but that it isn't wrapped by the win32api extension.

I may be wrong.

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml




More information about the Python-list mailing list