set environmental variable from python

Gisle Vanem gvanem at
Fri Oct 31 12:31:07 CET 2014

"Artur Bercik" <vbubbly21 at> wrote:

>I have to set several variables so it would be easier if I could set them
> from Python.

You can write a Python-script that generates a .bat file (in your %TEMP-dir?).
And run this .bat file when Python ends. Put it all in an alias or another .bat
file. E.g. untested:
 alias set_env=python <your-script> -o %TEMP%\set_env.bat & %TEMP%\set_env.bat


More information about the Python-list mailing list