remove registry keys using reg.exe in a batch script

Posted by Lex on Super User See other posts from Super User or by Lex
Published on 2012-09-25T15:02:19Z Indexed on 2012/09/25 15:39 UTC
Read the original article Hit count: 249

I've written this little batch script to help me auto-clean the registries of 300+ identical PC's of some very specific registry keys. It works right up to the point of passing the key variable to the "reg delete %1" command.

@echo off
C:
cd C:\Program Files\McAfee\Common Framework\
framepkg.exe remove=agent /silent

setlocal
for /F %%c in ('REG QUERY HKLM\SOFTWARE /s^|FIND "HKEY_"^|findstr /L /I /C:"mcafee"')  do call :delete %%c
endlocal
goto :EOF

:delete
reg delete /f %1
pause

Any and all debugging help would be extremely appreciated!

© Super User or respective owner

Related posts about windows-registry

Related posts about batch-file