RegRead errors on an existing key that doesn't have a default value set. You can't distinguish a
(a) "key not found" from a (b) "key has no default value" based solely on the err.number, both raise
error 0x80070002. You have to examine the err.description (a somewhat ugly solution):
In case (a) the description is:
Invalid root in registry key "<registry key here>".
In case (b) it's:
Unable to open registry key "<registry key here>" for reading.
--
Michael Harris
MVP Scripting
Reading key in registryHi
I need a vbscript that reads a key (not a value!!) in the registry. I've tried this example but it
only works with a key (eg. this doesn't work):
Set shell = Wscript.CreateObject("WScript.Shell")
'On Error Resume Next
Shell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\4.0\")
If Err.Number <> 0 Then
Wscript.Echo "Unable to get file; an error occurred."
Wscript.Echo "Err #" & Err.Number & ", " & Err.Description
Else
Wscript.Echo "Get file succeeded."
End If
Any hints?
Siv