require'win32/registry'
hkey_local_machine=Win32::Registry::HKEY_LOCAL_MACHINE
defgetKeyValue(hive, key_path, key_name)
reg_obj=hive.open(key_path, Win32::Registry::KEY_READ)
begin
reg_typ, reg_val = reg_obj.read(key_name)
rescue Win32::Registry::Error
puts "key not found : #{key_name}"
end
return reg_val
end
defGetIEBrowserVersion()
hkey_local_machine=Win32::Registry::HKEY_LOCAL_MACHINE
return getKeyValue(hkey_local_machine, "SOFTWARE\\Microsoft\\InternetExplorer", "Version")
end
k=GetIEBrowserVersion()
puts 'IE version:'+k
请发表评论