Environment Variable Modification with Scripts

I recently found an article on ASPN that demonstrates using Python to modify Environment Variables, especially the PATH variable.

The key to the article is that it demonstrates a way to make Environment Variable changes persistent. It does this by modifying the registry directly. After editing the registry, it causes a broadcast to be sent indicating the change in system settings. Although the example is in Python, this process is possible with any language that can access the Win32 system API.


win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SETTINGCHANGE, 0, 'Environment')

Reply

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.

More information about formatting options