怎么调用系统API啊
怎么写呢?path后面加一条。
追答os.environ['path']+=';path1'我在手机上写的,你凑合看
追问修改了以后仅仅在当前函数有用啊,实际的环境变量没变啊。再开一个程序调用 os.environ['path']还是原来的值
追答我找到个解答:
To programmatically add or modify system environment variables, add them to the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment registry key, then broadcast a WM_SETTINGCHANGE message with lParam set to the string "Environment". This allows applications, such as the shell, to pick up your updates. Note that the values of the environment variables listed in this key are limited to 1024 characters.
http://stackoverflow.com/questions/531998/is-there-a-way-to-set-the-environment-path-programatically-in-c-on-windows