문제

I have a generic registry key that has various strings dumped in it by programs:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders

How can I use a batch file to read the strings in the key, and if a string contains the word 'example' as part of the name, I want it to be deleted.

도움이 되었습니까?

해결책

try this:

@ECHO OFF &SETLOCAL
SET "key=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders"
SET "search=example"
FOR /f "delims=" %%a IN ('reg query "%key%" ^| find "%search%"') DO REG delete "%key%" /v "%%~a"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top