• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1142
  • Last Modified:

WSH and JScript: How to echo registry value names?

Newbie question:

Registry shows:

- ParentKey
      (Default)      REG_SZ                  (value not set)
         Str1           REG_SZ                   Data1
         Str2           REG_DWORD        0x00000001(1)

Strictly using JScript...

If I am ONLY given the key name, "ParentKey", how would you go about retrieving ALL Value Names and their corresponding Value Data under this key?

That is, I would like to be able to WScript.Echo
    Default: (Value not set)
    Str1: Data1
    Str2: 1

The extent of my knowledge with reading registry objects:

A simple RegRead requires a value name (ex.Str1)...

   var ws = WScript.CreateObject( "WScript.Shell" );
   WScript.Echo ( ws.RegRead("HKCU\\ParentKey\\Str1") );

Any ideas on how to get value names and more...?

Thank you in advance for any ideas.
1 Solution
Unfortunately, WSH by itself only allows you to at most query if a key exists, but not enumerate them.

You can try using regobj.dll to achieve this however, you may find it at

An example (although in vbscript) is here on how to enmuerate registry keys and their values with regobj.dll can be found here:

Hope this helps.
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now