1

I have uninstalled a recent game called "Wolfenstein 2009", but somehow I had to do it manually.

I was able to delete files very easily, but here comes the tricky part.

I have following command to query the Windows 7 64Bit OS Registry for getting all entries having "Wolf" in their key/value:

REG Query HKLM\Software /F "Wolf" /S

Now I want to delete all these entries either by for loop or a direct shortest command which can delete specific found multiple entries in shortest time.

I tried the following command but how to substitute variables in for loop is mystery as I don't do much batch scripting:

for /F "tokens=1,*" %%a in ('REG Query HKLM\Software /F "Wolf" /S') do (REG DELETE "%KEY%" /v %%a /f)

Can anyone help figuring this out ?

3
  • Although I cannot help you with a batch script, If you want to do it via Powershell I would be happy to help.
    – liam
    Commented Oct 23, 2017 at 19:30
  • Ok I have Powershell installed too, I can give it a shot, please post in answer.
    – Vicky Dev
    Commented Oct 23, 2017 at 19:31
  • The partial key, "wolf", might not be sufficient to exclude a vital key that has "wolf" as part of its name. I would use a tool such as Nirsoft's RegScanner to search for any undesired keys and values, select only those relevant, and delete the rest all at once with the tool. Commented Oct 23, 2017 at 21:54

1 Answer 1

0

If you use Powershell (as I said in my comment) try this:

Get-ChildItem -path HKLM:\ -Recurse | where { $_.Name -match 'office12'} | Remove-Item -Force

Alternatively, you can use Regscanner or if you need more power try PsExec along with it.

9
  • I am getting Requested Registry access is not allowed and Permission denied errors, on all entries
    – Vicky Dev
    Commented Oct 23, 2017 at 19:42
  • Do you have admin access on your computer?
    – liam
    Commented Oct 23, 2017 at 19:44
  • Yes my user is in the Admin group itself, do I need to run Powershell as administrator privilege ?
    – Vicky Dev
    Commented Oct 23, 2017 at 19:45
  • Are you running your programs as admin?
    – liam
    Commented Oct 23, 2017 at 19:46
  • 1
    Tried with Powershell as "Run as administrator", but still getting same errors.
    – Vicky Dev
    Commented Oct 23, 2017 at 19:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .