Jump to content

recurse entire registry and delete a key


kor
 Share

Recommended Posts

RegDelete("HKCR\Installer\Products\44C3ACC41ABF5B141889D9AABA1CB66E")
RegDelete("HKLM\SOFTWARE\Classes\Installer\Products\44C3ACC41ABF5B141889D9AABA1CB66E")
RegDelete("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\44C3ACC41ABF5B141889D9AABA1CB66E")
RegDelete("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{4CCA3C44-FBA1-41B5-8198-9DAAABC16BE6}")

Instead of manually saying exactly where in the registry to delete the above key.. does anyone have an easy loop to recurse the entire registry?

Basically, search entire registry for X key.. if found.. delete and continue. Continue until key not found.

(just looking to delete keys)

Link to comment
Share on other sites

RegDelete("HKCRInstallerProducts44C3ACC41ABF5B141889D9AABA1CB66E")
RegDelete("HKLMSOFTWAREClassesInstallerProducts44C3ACC41ABF5B141889D9AABA1CB66E")
RegDelete("HKLMSOFTWAREMicrosoftWindowsCurrentVersionInstallerUserDataS-1-5-18Products44C3ACC41ABF5B141889D9AABA1CB66E")
RegDelete("HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstall{4CCA3C44-FBA1-41B5-8198-9DAAABC16BE6}")

Instead of manually saying exactly where in the registry to delete the above key.. does anyone have an easy loop to recurse the entire registry?

Basically, search entire registry for X key.. if found.. delete and continue. Continue until key not found.

(just looking to delete keys)

Yep, the function here is made by SaltyPS if I remember correctly, I can't remember where the initial post was made, but I was playing around with the function and modifying it a little.

My version probably sucks, which is the version with the "2" in it, I took it out from a project I was working with and I'm not sure if I left anything out since I haven't touched it in a while.

#include <Array.au3> ; Only for _ArrayDisplay()
$Timer = TimerInit()
Global $Return = _RegSearch2("HKLMSoftwar", "Google Earth", 6)
ConsoleWrite("_RegSearch2(" & TimerDiff($Timer) & ")" & @CR)
_ArrayDisplay($Return)

$Timer = TimerInit()
Global $Return = _RegSearch("HKLMSoftware", "Google Earth", 6, True)
ConsoleWrite("_RegSearch(" & TimerDiff($Timer) & ")" & @CR)
_ArrayDisplay($Return)
Func _RegSearch2($sStartKey, $sSearchVal, $iType = 0x07)
    Local $i = 0, $sVal, $sKey, $sFound = "", $sFoundSub = "" ,$Count = 0
Local $Datum[1][2]
    ; Trim trailing backslash, if present
    If StringRight($sStartKey, 1) = "" Then $sStartKey = StringTrimRight($sStartKey, 1)
    ; Generate type flags
    If Not BitAND($iType, 0x07) Then Return SetError(1, 0, 0); No returns selected
    Local $fKeys = BitAND($iType, 0x1)
Local $fValue = BitAND($iType, 0x2)
Local $fData = BitAND($iType, 0x4)
    ; This checks values and data in the current key
    If ($fValue Or $fData) Then
        For $I = 1 To 999999
            $sVal = RegEnumVal($sStartKey, $i)
            Switch @error
    Case -1,1,2,3
     ExitLoop
    Case Else
     ; Valid value - test its name
     If $fValue Then
      If StringInStr($sVal, $sSearchVal,2) Then
       $Count += 1
       ReDim $Datum[$Count + 1][2]
       $sFound &= $sStartKey & "" & $sVal & @LF
       $Datum[$Count - 1][0] = $sStartKey & "" & $sVal
      EndIf
     EndIf
     ; test its data
     If $fData Then
      $readval = RegRead($sStartKey, $sVal)
      If StringInStr($readval, $sSearchVal,2) Then
       $Count += 1
       ReDim $Datum[$Count + 1][2]
       $Datum[$Count - 1][0] = $sStartKey & "" & $sVal
       $Datum[$Count - 1][1] = $readval
       $sFound &= $sStartKey & "" & $sVal & " = " & $readval & @LF
      EndIf
     EndIf
            EndSwitch
        Next
EndIf
    ; This loop checks subkeys
    For $I = 1 To 999999
        $sKey = RegEnumKey($sStartKey, $i)
        If @error = 0 Then
            ; Valid key - test it's name
            If $fKeys Then
    If StringInStr($sKey, $sSearchVal,2) Then
     $Count += 1
     ReDim $Datum[$Count + 1][2]
     $sFound &= $sStartKey & "" & $sKey & "" & @LF
     $Datum[$Count - 1][0] = $sStartKey & "" & $sKey & ""
                EndIf
            EndIf
            ; Now search it
            $sFoundSub = _RegSearch2($sStartKey & "" & $sKey, $sSearchVal, $iType) ; use string mode to test sub keys
   If Not @error Then
    For $x = 0 To UBound($sFoundSub) - 1
     If $sFoundSub[$x][0] Then
      $Count += 1
      ReDim $Datum[$Count + 1][2]
      $Datum[$Count - 1][0] = $sFoundSub[$x][0]
      $Datum[$Count - 1][1] = $sFoundSub[$x][1]
     EndIf
    Next
   EndIf
        Else
            ; No more keys here
            ExitLoop
        EndIf
Next
Switch $Count
  Case True
   ReDim $Datum[UBound($Datum)-1][2]
   Return SetError(0,$Count,$Datum)
  Case False
   Return SetError(1,0,0)
EndSwitch
Return SetError(0,$Count,$Datum)
EndFunc   ;==>_RegSearch

Func _RegSearch($sStartKey, $sSearchVal, $iType = 0x07, $fArray = False)
    Local $v, $sVal, $k, $sKey, $sFound = "", $sFoundSub = "", $avFound[1] = [0]
    ; Trim trailing backslash, if present
    If StringRight($sStartKey, 1) = "" Then $sStartKey = StringTrimRight($sStartKey, 1)
    ; Generate type flags
    If Not BitAND($iType, 0x07) Then Return SetError(1, 0, 0); No returns selected
    Local $fKeys = BitAND($iType, 0x1), $fValue = BitAND($iType, 0x2), $fData = BitAND($iType, 0x4), $fRegExp = BitAND($iType, 0x8)
    ; Check for wildcard
    If (Not $fRegExp) And ($sSearchVal == "*") Then
        ; Use RegExp pattern "." to match anything
        $iType += 0x8
        $fRegExp = 0x8
        $sSearchVal = "."
    EndIf
    ; This checks values and data in the current key
    If ($fValue Or $fData) Then
        $v = 1
        While 1
            $sVal = RegEnumVal($sStartKey, $v)
            If @error = 0 Then
                ; Valid value - test its name
                If $fValue Then
                    If $fRegExp Then
                   ;     If StringRegExp($sVal, $sSearchVal, 0) Then $sFound &= $sStartKey & "" & $sVal & @LF
                    Else
                        If StringInStr($sVal, $sSearchVal) Then $sFound &= $sStartKey & "" & $sVal & @LF
                    EndIf
                EndIf
                ; test its data
                If $fData Then
                    $readval = RegRead($sStartKey, $sVal)
                    If $fRegExp Then
                   ;     If StringRegExp($readval, $sSearchVal, 0) Then $sFound &= $sStartKey & "" & $sVal & " = " & $readval & @LF
                    Else
                        If StringInStr($readval, $sSearchVal) Then $sFound &= $sStartKey & "" & $sVal & " = " & $readval & @LF
                    EndIf
                EndIf
                $v += 1
            Else
                ; No more values here
                ExitLoop
            EndIf
        WEnd
    EndIf
    ; This loop checks subkeys
    $k = 1
    While 1
        $sKey = RegEnumKey($sStartKey, $k)
        If @error = 0 Then
            ; Valid key - test it's name
            If $fKeys Then
                If $fRegExp Then
                ;   If StringRegExp($sKey, $sSearchVal, 0) Then $sFound &= $sStartKey & "" & $sKey & "" & @LF
                Else
                    If StringInStr($sKey, $sSearchVal) Then $sFound &= $sStartKey & "" & $sKey & "" & @LF
                EndIf
            EndIf
            ; Now search it
            $sFoundSub = _RegSearch($sStartKey & "" & $sKey, $sSearchVal, $iType, False) ; use string mode to test sub keys
            If $sFoundSub <> "" Then $sFound &= $sFoundSub & @LF
        Else
            ; No more keys here
            ExitLoop
        EndIf
        $k += 1
    WEnd
    ; Return results
    If StringRight($sFound, 1) = @LF Then $sFound = StringTrimRight($sFound, 1)
    If $fArray Then
        If StringStripWS($sFound, 8) <> "" Then $avFound = StringSplit($sFound, @LF)
        Return $avFound
    Else
        Return $sFound
    EndIf
EndFunc   ;==>_RegSearch

Edit: just found it after a quick search...

Edited by ApudAngelorum
Link to comment
Share on other sites

Maybe this will help?

; _IsRegistryExist() ~ Author - guinness
ConsoleWrite(_IsRegistryExist("HKEY_CURRENT_USER\Control Panel\Desktop", "Test") & @LF) ; False = Doesn't Exist
ConsoleWrite(_IsRegistryExist("HKEY_CURRENT_USER\Control Panel\Desktop", "CaretWidth") & @LF) ; True = Exists

Func _IsRegistryExist($sKeyName, $sValueName)
    RegRead($sKeyName, $sValueName)
    Return @error = 0
EndFunc   ;==>_IsRegistryExist
Link to comment
Share on other sites

Maybe this will help?

; _IsRegistryExist() ~ Author - guinness
ConsoleWrite(_IsRegistryExist("HKEY_CURRENT_USERControl PanelDesktop", "Test") & @LF) ; False = Doesn't Exist
ConsoleWrite(_IsRegistryExist("HKEY_CURRENT_USERControl PanelDesktop", "CaretWidth") & @LF) ; True = Exists

Func _IsRegistryExist($sKeyName, $sValueName)
    RegRead($sKeyName, $sValueName)
    Return @error = 0
EndFunc   ;==>_IsRegistryExist

how would you use this to only search for a key and not a value?
Link to comment
Share on other sites

By searching for the "Default" Key

from the helpfile:

To access the (Default) value use "" (a blank string) for the valuename.

But after i added this for you, i was doing some testing to show how and it doesn't work something with windows prevents it

I checked with guinness and he confirms windows is the issue.

which is a shame as i thought it would help.

Back to the drawing board

Edited by Chimaera
Link to comment
Share on other sites

I can only presume because AutoIt returns the @error code of -1 'if unable to open requested value' so it can't open the value, therefore default ('') isn't a valid value for that particular registry key.

From skimming this problem quickly _RegSearch is probably what you're after.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

_RegSearch doesn't seem to allow to search the entire registry, unless I'm doing something wrong.

; Syntax: _RegSearch($sStartKey, $sSearchVal, $iType = 0x07, $fArray = False)

;

; Where: $sStartKey = Reg path at which to begin search

How do I set StartKey to be the root of the registry to search everything? If I set startkey to be HKLM it only searches the Local Machine, but I want it to search everything.
Link to comment
Share on other sites

At a guess you will need to make an array or something like that to hold the main HKCU /HKLM etc factor then cycle through them with a search.

Or just call it 4 times once for each section to search?

$sStartKey = "HKEY_CLASSES_ROOT"

_RegSearch($sStartKey, $sSearchVal, $iType = 0x07, $fArray = False)

$sStartKey = "HKEY_CURRENT_USER"

_RegSearch($sStartKey, $sSearchVal, $iType = 0x07, $fArray = False)

etc etc

Link to comment
Share on other sites

Think about it you can't search all drives at once you have to enumerate through each one. Same applies here too.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

That doesn't seem right. There has to be a way to select the root of the registry tree instead of running the search function 5 times.

You can modify the function to cycle through the base registry keys to get the desired results, it's not too hard.

That's like saying "This doesn't seem right. There has to be a way to take a dump and urinate though one location.".

Link to comment
Share on other sites

That's like saying "This doesn't seem right. There has to be a way to take a dump and urinate though one location.".

I disagree. I can parse through the entire registry in the GUI just by clicking Find.

Thus there has to be a way to specify the ROOT of the registry.

Link to comment
Share on other sites

According to MSDN, the RegEnumVal has to have one of the 5 keys selected, you can't use it from the root location. If you try it, for example, using "Computer" as the key it will return an error.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Can't help but feel post #10 hit the nail on the head, which I don't think kor saw.

Plus perhaps it's just me but doesn't it take roughly the same amount of time to search the registry entirely or by enumerating through the 5 keys, albeit there is a little more code (5 lines or so) to write but still the same time.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I might be way out of line, but here goes.

Looking at the code from the original post, you seem to know what the keys are.

If you deleted 1000 keys just like the ones in post #1 -- it would take a few seconds.

On the other hand, if you were to recursively search the entire registry for them, it would take... well, a fairly long time.

It might be a better strategy to write all your keys to a file and use something like _FileReadToArray or use an IniFile and enumerate through the keys.

Just my opinion.

Example:

#include 'File.au3'

Local $sFile = @ScriptDir & 'KeysToDelete.txt'
If Not FileExists($sFile) Then Exit

Local $aKeys
_FileReadToArray($sFile, $aKeys)

For $i = 1 To $aKeys[0]
    RegDelete($aKeys[$i])
Next

In any case, good luck to you.

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...