Using: Windows 7 Pro SP1 x64
I'm trying to delete an existing value in my registry (verified
existence using regedit) with the following code:
···
####
require 'win32/registry'
keyname = 'SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate'
access = Win32::Registry::KEY_ALL_ACCESS
Win32::Registry::HKEY_LOCAL_MACHINE.open(keyname, access) do |reg|
reg.delete_value('SusClientId')
end
####
the output of which yields the following exception:
C:/Ruby200/lib/ruby/2.0.0/win32/registry.rb:768:in `delete_value': The
system cannot find the file specified. (Win32::Registry::Error)
from C:/main_script.rb:7:in `block in <main>'
from C:/Ruby200/lib/ruby/2.0.0/win32/registry.rb:389:in `open'
from C:/Ruby200/lib/ruby/2.0.0/win32/registry.rb:496:in `open'
from C:/main_script.rb:6:in `<main>'
Could anyone help me with some insight? Thanks in advance
--
Posted via http://www.ruby-forum.com/.