Jump to content
Sign in to follow this  
GAM

Wild card in registry

Recommended Posts

GAM
Hi
Am trying to list out all the keys and subkeys under the registry path "HKLMSOFTWAREWow6432NodeMyCompany"; and am able to get the out put successfully. But there are other registry paths from where I have to retrieve the data which are dynamic in naming convention here am failing to get the output. The only thing that does NOT change in the naming convention is the first three letters "MFK". I have tried the below script by using "*" but that does NOT work.
 
$RegPathOfRoot = "HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMFK*"
 
Any help please!
 
Thanks in Advance.
 
---------------------------------------------------------------------------------------------------------------------------------------------------------
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
 
$sFilePath = "FileWriteLine.txt"
$sSubKey = ""
$RegPathOfRoot = "HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMyCompanyDesktopProtection"
 
recursiveGetReg($RegPathOfRoot)
 
Func recursiveGetReg($RegPath)
$hFileOpen = FileOpen($sFilePath, $FO_APPEND)
   If $hFileOpen = -1 Then
       MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file.")
       Return False
   EndIf
 
For $i = 1 To 200
    $sSubKey = RegEnumKey($RegPath, $i)
    If @error Then ExitLoop
    Local $sVar = ""
For $j = 1 To 500
$sVar = RegEnumVal($RegPath & "" & $sSubKey, $j)
If @error <> 0 Then ExitLoop
FileWriteLine($hFileOpen, $RegPath & "" & $sSubKey & "" & $sVar & @CRLF)
;Sleep(200)
;RegDelete($RegPath & "" & $sSubKey, $sVar)
Next
 If RegEnumKey($RegPath & "" & $sSubKey, 1) = "" Then
 Else
recursiveGetReg($RegPath & "" & $sSubKey)
 EndIf
Next
FileClose($hFileOpen)
EndFunc
---------------------------------------------------------------------------------------------------------------------------------------------------------

Neil

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  

×