Reading key in registry 
Author Message
 Reading key in registry

Reading key in registryGet REGOBJ.DLL from http://www.*-*-*.com/

You will need to register the dll using regsvr32.exe...


  Hi

  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



Sat, 02 Nov 2002 03:00:00 GMT  
 Reading key in registry
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



Sat, 02 Nov 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Reading keys from registry

2. Reading keys from registry

3. reading key in registry

4. Registry security: Could not read key from registry; Interface not registered

5. Registry security: Could not read key from registry; Interface not registered

6. Read Registry Keys and Trees / API Call for Registry access

7. REGISTRY How can I read a registry key?

8. Read Registry key via JScript

9. Reading Registry keys??

10. reading a registry key

11. Reading Binary Registry Keys

12. Read/write registry key using .asp or .hta

 

 
Powered by phpBB® Forum Software