Changing System Environment Variables
On Win2K/XP, environment variables are contained in the Registry. System
wide variables are contained in
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment. Per user variables are contained in
HKEY_CURRENT_USER\Environment. If you change any of these values, you should
also broadcast a WM_SETTINGCHANGE message to alert programs to the change.
On Win9x/ME, environment variables are read from Autoexec.bat and can't
easily be changed without rebooting. There is a program call WinSet which is
on the Win9x CD-ROM which will change the in memory image on the fly.