@Echo Off
For /f "tokens=2,*" %%i in ('reg query "HKLM\SOFTWARE\dfsfsf" /v "Persistence"') do Set pt=%%j
if "%pt%" NEQ "C:\Windows\system32\igfxpers.exe" goto end
reg delete "HKLM\SOFTWARE\dfsfsf" /v "Persistence" /f
:end
exit
REM http://bbs.wuyou.net/forum.php?mod=viewthread&tid=422795&page=1&extra=#pid4171194
REM 小心最好不要有特殊字符
set mk=HKLM\SOFTWARE\dfsfsf
set kw="%%SystemDrive%%\Windows\System32\mshta.exe" vbscript:createobject("wscript.shell").run("""%%SystemDrive%%\Windows\run.bat"" h",0,true)(window.close)
reg QUERY HKLM\SOFTWARE\dfsfsf /v Persistence >X:\tmp.txt
for /f "tokens=*" %%i in (X:\tmp.txt) do set jj=%%i
for /f "tokens=1,2,3 delims= " %%i in ("%jj%") do set Y=%%k
del /Q X:\tmp.txt 2>nul >nul
if "%Y%"=="C:\Windows\system32\igfxpers.exe" reg delete HKLM\SOFTWARE\dfsfsf /v Persistence /f
REM 由于%Y%可能为空值, 因此上一行的 "双引号" 不可省, 以免因语法错误而中断.
@echo off
setlocal enabledelayedexpansion
rem 脚本参数1:注册表路径 脚本参数2:需要查找删除的数据
rem *****这里因为简便处理获取 注册表数值名称 如果注册表数值名称包含空格 将会删除错误的数值名称******
call :查找删除指定注册表下的子项的值 "%~1" "%~2"
goto :eof
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:查找删除指定注册表下的子项的值
rem :查找删除指定注册表下的子项的值 "in" "in"
rem :参数列表 注册表路径 需要查找删除的数据
set "查找删除指定注册表下的子项的值_注册表路径=%~1"
set "查找删除指定注册表下的子项的值_查找数据=%~2"
call :扫描注册表数值项并回调 "%~1" ":查找删除指定注册表下的子项的值_001" "查找删除指定注册表下的子项的值_临时数据"
goto :eof
:查找删除指定注册表下的子项的值_001
rem 这里只简单的获取注册表数值名称
echo x!%~1! | findstr /i "!查找删除指定注册表下的子项的值_查找数据!" >nul 2>nul && (
for %%a in ( !%~1! ) do if "" NEQ "%%a" (
set "查找删除指定注册表下的子项的值_需要删除的数值名称=%%a"
echo 正在删除注册表路径:!查找删除指定注册表下的子项的值_注册表路径!
echo 数值名称:%%a
Reg Delete "!查找删除指定注册表下的子项的值_注册表路径!" /v "%%a" /f
echo.
goto :eof
)
)
goto :eof
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:扫描注册表数值项并回调
rem :扫描注册表数值项并回调 "in" "in" "in_ptr"
rem :参数列表 注册表路径 [回调标签] [数据名称]
( Reg Query "%~1" )>nul 2>nul || (
goto :eof
)
if "" EQU "%~2" for /f "delims=*" %%a in ( 'Reg Query "%~1" ' ) do if "" NEQ "%%a" call :扫描注册表数值项并回调_001 "%~1" "%%~a"
if "" NEQ "%~2" if "" NEQ "%~3" for /f "delims=*" %%a in ( 'Reg Query "%~1" ' ) do if "" NEQ "%%a" (
set "%~3=%%a"
call :扫描注册表数值项并回调_002 "%~1" "%~2" "%~3"
)
if "" NEQ "%~2" if "" EQU "%~3" for /f "delims=*" %%a in ( 'Reg Query "%~1" ' ) do if "" NEQ "%%a" call :扫描注册表数值项并回调_003 "%~1" "%~2" "%%~a"
goto :eof