How do I delete registry subkeys using .reg file?

Posted on

QUESTION :

I’m creating a .reg file that will delete certain subkeys. So, just for an example, say I want to delete the ‘Count‘ subkey, which is located here:

HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerUserAssist

There are two subkeys in the user assist folder that look like this:

{5E39430943 etc}

Inside that, lies the ‘Count’ subkey. So the structure is like this:

HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerUserAssist
 {5E39430943 etc}
  Count

I’m not 100% sure, but I think the second key MIGHT be a variable, that is, different on each computer.

So how would my registry file look if I wanted to delete that subkey but there was a variable parent key above?

Thanks in advance.

ANSWER :

I found that it’s not a variable and that if you simply type in the key you want to create in the .reg file e.g

HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerUserAssist

Enclosing it in [] so it looks like this:

[HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerUserAssist]

It will create the key.

To delete the key, there should be a minus before the key, like this:

[-HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerUserAssist]

Hope this helps someone else.

Leave a Reply

Your email address will not be published.