for /f "skip=3 delims=" %%A in ('reg query "HKEY_LITERAL_REG_PATH"') do ( echo %%A | findstr "HKEY" > nul if not errorlevel 1 (reg delete %%A) )