I use the following method. This is part of a MRU ripper for Windows XP, that might help. This is the text of a batch file, that is run from CMD or from a shortcut. It creates a registry file using simple echo redirections, then imports it.
REM *** START REGISTRY SHREDDER ***
ECHO CREATING MRU REGISTRY
ECHO > "%TMP%\MRUKILL.reg" Windows Registry Editor Version 5.00
ECHO >> "%TMP%\MRUKILL.reg" [-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Doc Find Spec MRU]
ECHO >> "%TMP%\MRUKILL.reg" [-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FindComputerMRU]
REM *** IMPORT THAT REG TO WIPE OUT THEM KEYS AND VALUES ****
I am not a coder, I just do some batch stuff for myself, so I often can't even read what I wrote, but I would use that as a template for doing something else.
echos are redirected (
>) to a file, with the single
> for the first redirection, and
>> to append to the same file. The
- sign is used to remove a registry entry. It would probably be good to leave off the last line, and view the file it created before importing. Importing can be done silently, but I won't do that myself.
Disclaimer: Because a person can do some serious damage to the system removing registry entries, an disk image backup that can return the system when the system fails is necessary.
Proper permissions, elevations, and some entries in the registry will not just allow the user to destroy them, without setting the permissions, because of their importance.
Here is A "ask the user" part, added just for fun.
REM *** ASK the USER FIRST ***
ECHO DO YOU WANT TO DELETE REGISTRY MRUS?
SET /P Choice2=type "Y" to Mangle your registry, - -
IF /I "%Choice2%"=="Y" GOTO SHREDD
ECHO OK WELL THEN I WON'T
ECHO By By
REM *** USER DECIDED AGAINST IT ***