我有以下代码:
Dim objShell,failing_path,working_path
failing_path = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Test"
working_path = "HKEY_LOCAL_MACHINE\SOFTWARE\7-zip\Path"
Set objShell = WScript.CreateObject("WScript.Shell")
WScript.Echo "Working: " & objShell.RegRead(working_path)
WScript.Echo "Not Working: " & objShell.RegRead(failing_path)
执行时,我将从中获取路径7-zip Registrykey
,但Test
键返回以下错误:
错误说:注册表未打开以供阅读。
这里是Test-Key存在的证明:
我究竟做错了什么?我也尝试通过读取密钥,oReg.GetStringValue
但这总是返回 null。