Meldrum
Meldrum

Reputation: 57

Removing a registry key and its subkeys using a batch

I need to remove a registry key (including its subkeys) from a batch file.

The examples I found led me to the following code but the key remains?

@ECHO OFF
REG DELETE "HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.0\ACAD-8001:409\Profiles\STDPROFILE" /V

Upvotes: 2

Views: 4951

Answers (1)

BlackBear
BlackBear

Reputation: 22979

Not so good at batch programming, but

reg query "HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.0\ACAD-8001:409\Profiles\STDPROFILE" /s > toDelete.txt
for /f %v in (toDelete.txt) do reg delete %v

the first line puts every key and value in a file, then the loop reads them and calls reg delete

Upvotes: 2

Related Questions