注册表搜索&替换批处理文件

时间:2016-02-28 08:15:12

标签: batch-file registry

如何创建批处理文件  在注册表中搜索所有存在ACADLSPASDOC并将数据值从0更换为1

1 个答案:

答案 0 :(得分:0)

尝试使用此批处理脚本进行搜索:

@echo off
cls & color 0A & echo.
Mode con cols=55 lines=5
Title Check Registry Keys by Hackoo 2016
:::::::::::::::::::::::::::::::::::::::::
:: Automatically check & get admin rights
:::::::::::::::::::::::::::::::::::::::::
CLS
Echo.
Echo.
ECHO         **************************************
ECHO          Running Admin shell... Please wait...
ECHO         **************************************

:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )

:getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
Echo.
ECHO.
ECHO         **************************************
ECHO          Invoking UAC for Privilege Escalation
ECHO         **************************************

setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
(
ECHO Set UAC = CreateObject^("Shell.Application"^)
ECHO args = "ELEV "
ECHO For Each strArg in WScript.Arguments
ECHO args = args ^& strArg ^& " "
ECHO Next
ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 
)> "%temp%\OEgetPrivileges.vbs"
"%SystemRoot%\System32\WScript.exe" "%temp%\OEgetPrivileges.vbs" %*
exit /B

:gotPrivileges
if '%1'=='ELEV' shift /1
setlocal & pushd .
cd /d "%~dp0"
::::::::::::::::::::::::::::
::START
::::::::::::::::::::::::::::
Title Check Registry Keys by Hackoo 2016
Set SearchString=ACADLSPASDOC
Set mykey="HKCU" "HKLM" "HKCR" "HKU" "HKCC"
Set TmpLogFile=Tmplogkey.txt
Set LogFile=Logkey.txt
If Exist %TmpLogFile% Del %TmpLogFile%
If Exist %LogFile% Del %LogFile%
For %%K in (%mykey%) Do Call :Check_Key %%K %SearchString% %TmpLogFile%
Cmd /U /C Type %TmpLogFile% > %LogFile%
Start "" %LogFile%
If Exist %TmpLogFile% Del %TmpLogFile%
Exit /b

:Check_Key
reg QUERY "%~1" >nul 2>&1
(
  if %errorlevel% equ 0 ( Echo. "%~1" & reg QUERY "%~1" /S /V "%~2" & echo. *************
    ) else ( echo "%~1" ===^> Not found
  )
) >>%3 2>&1
相关问题