Jump to content

Wildcards using RegEdit?


dazza
 Share

Recommended Posts

I need to remove all folders in:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

that begin with KB

eg

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KBbatman

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KBspiderman

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KBhulk

RegEdit doesn't take wild cards (*).

Show me the way people ;)

Link to comment
Share on other sites

I need to remove all folders in:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

that begin with KB

eg

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KBbatman

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KBspiderman

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KBhulk

RegEdit doesn't take wild cards (*).

Show me the way people ;)

Try this:

$NUM = 1
While 1
    $KEY = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\",$NUM)
    If @error <> 0 then ExitLoop
    MsgBox(0,$NUM,$KEY)
    If StringLeft($KEY,2) = "KB" Then
        RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $KEY)
    EndIf
    $NUM += 1
WEnd

When the words fail... music speaks.

Link to comment
Share on other sites

Many thanks for the code but... this function deletes keys. I need folders deleted in the registry (and all keys within).

Like:

DirRemove($path, 1)

But:

RegistryDirRemove($path, 1)
"Folders" are keys. "Keys" are values. There are no folders in the Windows registry. Regedit uses a folder icon to make it more visually understandable that keys hold values the way folders hold files.

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Link to comment
Share on other sites

  • 9 months later...

<headbutts the screen>

Cheers people. I'll go and take my clever pill now.

I am trying to do something like this, see my thread please. http://www.autoitscript.com/forum/index.ph...mp;#entry696500

I need to delete all the keys within the hklm\system\currentcontrolset\control\print\monitors\standardtcp/ip port\ports\ key. I am confused as how to get it to recursively delete all the sub keys for each key and then the key itself?

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...