extending PATH on Windows?

Ulli Horlacher framstag at rus.uni-stuttgart.de
Tue Feb 16 03:30:59 EST 2016


I need to extend the PATH environment variable on Windows.

So far, I use:

   system('setx PATH "%PATH%;'+bindir+'"')

The problem: In a new process (cmd.exe) PATH contains a lot of double
elements. As far as I have understood, Windows builds the PATH
environment variable from a system component and a user component. With
the setx command from above I have copied the system PATH into the user
PATH component.

Is there a better way to extend the PATH environment variable for the user?
It must be persistent, not only for the current process.


-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum IZUS/TIK         E-Mail: horlacher at tik.uni-stuttgart.de
Universitaet Stuttgart         Tel:    ++49-711-68565868
Allmandring 30a                Fax:    ++49-711-682357
70550 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/



More information about the Python-list mailing list