Sign in to follow this  
Followers 0
dazza

Wildcards using RegEdit?

7 posts in this topic

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 ;)

Share this post


Link to post
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

Share this post


Link to post
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)

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

<headbutts the screen>

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

You don't need to delete subkeys. Just remove the top most key that you want to remove. It's stupid to span it first.

Also, your question was not related to the thread.

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