From: yermej Date: 2007-12-08T11:35:20+09:00 Subject: Re: working with the registry On Dec 7, 7:15 pm, Thufir wrote: > but would like to query the registry from ruby. Just thinking outloud > here, haven't found a tutorial invovling the registry and ruby which I > find useful yet :( The following is what I was able to figure out from the standard library API docs at http://www.ruby-doc.org/stdlib/. It's pretty Rubyish once you get going. >>> C:\msi>reg query HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer [in irb] irb> require 'win32/registry' irb> include Win32 irb> Registry.open(Registry::HKEY_LOCAL_MACHINE, 'Software\Policies \Microsoft\Windows\Installer').each_value do |subkey, type, data| irb* puts "#{subkey} (#{type}): #{data}" irb> end The only problem I see with this is that you get the constant value for type (4 in this case) rather than the constant name (REG_DWORD). Is that what you were wanting to do? >>> C:\msi>reg query HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows I don't have this key on my machine. Only HKEY_CURRENT_USER\Software \Policies\Microsoft\SystemCertificates which has subkeys, but no values, but all keys should be similar to the above.