0

到目前为止我有这个代码

require 'win32/registry'


Win32::Registry::HKEY_LOCAL_MACHINE.open('Software\Microsoft\Windows NT\CurrentVersion',Win32::Registry::KEY_ALL_ACCESS) do |reg|

 puts reg['DigitalProductId']

end

但它不允许我获得 DigitalProductId 值。有些值可用,但有些不可用。

CurrentVersion
CurrentBuild
SoftwareType
CurrentType
InstallDate
RegisteredOrganization
RegisteredOwner
SystemRoot
InstallationType
EditionID
ProductName
CurrentBuildNumber
BuildLab
BuildLabEx
BuildGUID
CSDBuildNumber
PathName
4

1 回答 1

0

这是因为您在 64 位机器上运行。在您将 TragetPlatform 更改为 X64 位 CPU 之前,它无法从注册表中识别键“DigitalProductId”。

希望能帮助到你

于 2013-10-20T10:54:42.130 回答