Jump to content
Sign in to follow this  

Modify registry key

Recommended Posts

Say that....

HKLMSystemCurrentControlSetControlClassABC contains several different subkeys, such as




Within one of these three subkeys, lies a value name that needs to be changed - we'll call it VALNAME. So it would need to find which one of those three subkeys holds VALNAME - which would be modified.

I am thinking I could just use regread to search for it, but am curious on the best way to parse through them (There are way more than 3 subkeys to search through; this is purely for example)

Share this post

Link to post
Share on other sites

Ok, so using RegEnumKey. 

For example,

For $i = 1 to 20
     Local $var = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\ABC\", $i)


How should you parse through each of those three subkeys above to find "VALNAME"?

Share this post

Link to post
Share on other sites

Taken almost word for word from the example under RegEnumKey...

$path = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\ABC\"
For $i = 1 To 100
    $sSubKey = RegEnumKey($path, $i)
        If @error Then
            $var = RegRead($path & $sSubKey, "VALNAME")
                    If Not @error Then MsgBox(0, $path & $sSubKey, $var)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...