> -----Original Message-----
> From: Harry Ohlsen [mailto:harryo / qiqsolutions.com] 
> Sent: Wednesday, November 05, 2003 10:22 PM
> To: ruby-talk ML
> Subject: Updating path in windows
> 
> 
> I'm writing a simple install script for some software.  The 
> final thing I need to do is to add into the path the 
> directory where the software has been written.
> 
> Using Win32::Registry, I can update what I think are the 
> right registry entries (for either the user, or the system 
> overall), but they don't seem to end up in the path if I open 
> a new DOS window.
> 
> However, if I change the same variables via 
> ControlPanel/System/Advanced/EnvironmentVariables things work 
> OK.  It seems as though that tool is doing something else 
> over and above changing the registry.
> 
> I assume there must be some API call I need to make to get 
> Windows to re-read the values from the registry?
> 
> Anyone have any ideas?
> 
> Cheers,
> 
> Harry O.

I haven't looked at Win32::Registry, but this is from the MSDN site:

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. This allows applications, such as the shell, to pick up your
updates.

So, perhaps there's some sort of "update" method that broadcasts the
WM_SETTINGCHANGE.  Otherwise, your option is OS.reboot. :)

Regards,

Dan