Sign in to follow this  
Followers 0
obfuscatedv

Modify registry key

4 posts in this topic

Say that....

HKLMSystemCurrentControlSetControlClassABC contains several different subkeys, such as

HKLMSystemCurrentControlSetControlClassABC123

HKLMSystemCurrentControlSetControlClassABC456

HKLMSystemCurrentControlSetControlClassABC789

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



Look at RegEnumKey in the help file.


√-1 2^3 ∑ π, and it was delicious!

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
            ExitLoop
        Else
            $var = RegRead($path & $sSubKey, "VALNAME")
                    If Not @error Then MsgBox(0, $path & $sSubKey, $var)
        EndIf
Next
1 person likes this

√-1 2^3 ∑ π, and it was delicious!

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  
Followers 0