how to read all the values of a registry key with vbscript?

14,085

Well, I got it

I had to use wmi, like this:

option explicit

const HKLM = &H80000002

dim keyPath
keyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Accepted Documents"

dim reg

dim valueNames, types
dim value
dim i

  set reg = getObject( "Winmgmts:root\default:StdRegProv" )

  if reg.enumValues( HKLM, keyPath, valueNames, types ) = 0 then
    if isArray( valueNames ) then
      for i = 0 to UBound( valueNames )
        reg.getStringValue HKLM, keyPath, valueNames(i), value
        msgBox( valueNames(i) & "=" & value )
      next
    end if
  end if

saludos

sas

Share:
14,085
opensas
Author by

opensas

Updated on June 04, 2022

Comments

  • opensas
    opensas almost 2 years

    I have the following values in my registry

    key:

    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Accepted Documents\

    values:

    * -> application/msword
    ** -> application/vnd.ms-excel
    *** -> application/vnd.ms-powerpoint
    

    and so on

    I'd like to know how to read all of them

    with Wscript.Shell, RegRead I can only read one value, but I don't know the values in advance...