Following on from my previous question, is it possible to make a Python script which persistently changes a Windows environment variable?
Changes to os.environ do not persist once the python interpreter terminates. If I were scripting this on UNIX, I might do something like:
set foo=`myscript.py`
But alas, cmd.exe does not have anything that works like sh's back-tick behavior. I have seen a very long-winded solution... it 'aint pretty so surely we can improve on this:
for /f "tokens=1* delims=" %%a in ('python ..\myscript.py') do set path=%path%;%%a
Surely the minds at Microsoft have a better solution than this!
Note: exact duplicate of this question.