Score:0

Delete selected subkeys in a registry key

ie flag

I need to Delete selected subkeys in a registry key. For one of the subkeys I need to delete I tried:

(SET _KEY=SOFTWARE\Microsoft\Windows\CurrentVersion\UFH\SHC)
REG Delete "HKCU\%_KEY%" /V "C:\ProgramData\Microsoft\Windows\Start      Menu\Programs\UltraVNC\UltraVNC Viewer\UltraVNC Viewer (Listen Mode  Encrypt)).lnk
C:\Program Files\uvnc bvba\UltraVNC\vncviewer.exe
-dsmplugin SecureVNCPlugin64.dsm -listen 5500
" /f

And it asked me (Y or N)

I know it didn't work because it shouldn't have asked (Y or N) because I have /f. I think the problem is the subkey has multiple lines. I have about 60 subkeys that I need to delete under this Key. All the sub keys I need to delete have "uvnc bvba" in the subkey. It would be nice to have a for loop to find the right ones to delete.

Score:0
ie flag

I think I figured out how to answer my own question.

@Echo Off
Set "Key=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\UFH\SHC"
Set "Str=uvnc bvba"
setlocal EnableExtensions DisableDelayedExpansion
for /F "EOL=E Delims=" %%I in ('@%SystemRoot%\System32\reg.exe query "%Key%" /v * ^| find "%Str%"') do (Echo=reg   delete "%Key%" /v "%%~I" /f 2>nul
if not errorlevel 1 echo Deleted "%%~I" from %Key%
)
endlocal

cmd /k

I'd welcome any comments if I am doing something wrong or there is a better way of doing it.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.