Can a python script persistently change a Windows environment variable? (elegantly)

后端 未结 5 2007
失恋的感觉
失恋的感觉 2020-12-16 02:34

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 n

5条回答
  •  孤街浪徒
    2020-12-16 02:51

    Windows sets Environment variables from values stored in the Registry for each process independently.

    However, there is a tool in the Windows XP Service Pack 2 Support Tools named setx.exe that allows you to change global Environment variables from the command line.

提交回复
热议问题