Following my previous question, is it possible to create a Python script that constantly changes the Windows environment variable?
Changes to os.environ are not saved after python interpreter completes. If I had scripted this on UNIX, I could do something like:
set foo=`myscript.py`
But alas, cmd.exe has nothing that works like the behavior of back back-tick. I saw a very protracted solution ... Of course, we can improve this:
for /f "tokens=1* delims=" %%a in ('python ..\myscript.py') do set path=%path%;%%a
Of course, minds at Microsoft have a better solution than that!
Note : an exact duplicate of this question .
python windows scripting batch-file
Salim fadhley
source share