刚玩bat,想写个清理指定软件注册表的功能 想了半天也没写出来 ,求指点,在sc_1模块中,
自动实现搜索注册表中所有的,项、值、数据,然后把它们统统删掉,关键字是”CorelDRAW“
,第一次写这个 不足支持望老鸟指点
就像这样 搜到后 就删了
后来折腾了2小时 终于知道怎么弄了,这是完全版的- for /f %%i in ('reg query HKLM\software /s /f "CorelDRAW" ^| findstr /i "^HKEY"') do (
- reg delete %%i /f
- )
复制代码 上面是关键部分- @ECHO OFF&PUSHD %~DP0 &TITLE corelx7 屏蔽正版提示脚本
- color 0a
- :menu
- cls
- echo.
- echo 请输入数字,按照步骤进行,使用前请确保CorelDRAW X7已经卸载干净并且电脑全程断网!!!,同时请关掉360等安全软件并且右键管理员运行
- echo ==============================
- echo.
- echo 输入1,清理corel注册表残余
- echo.
- echo 输入2,加入防火规则,禁止corelx7联网
- echo.
- echo 输入3,写入host规则,屏蔽corel域名
- echo.
- echo ==============================
- echo.
- echo.
- set /p select=输入数字,按回车继续:
- if "%select%"=="1" (goto sc_1)
- if "%select%"=="2" (goto sc_2)
- if "%select%"=="3" (goto sc_3)
-
- :sc_1
- @echo off
- cls && echo 即清理corelx7注册表残余,请把软件卸载干净后运行,切记全程断网!!!
- pause
- color 0a
- echo.
- echo 请不要关闭窗口,程序正在后台运行。。。
- reg query HKLM\software /s /f "CorelDRAW" | findstr /i "^HKEY" > deletecore7reg.txt
- for /f %%i in ('reg query HKLM\software /s /f "CorelDRAW" ^| findstr /i "^HKEY"') do (
- reg delete %%i /f
- )
- cls && echo 清理完毕,任意键回到主菜单,删除的注册表记录生成到了 deletecore7reg.txt
- pause
- goto menu
-
- :sc_2
- TITLE corelx7 防火墙规则写入
- color 0c
- cls && echo 即将进入步骤二添加防火墙规则,请在断网状态下安装好CorelDRAW X7并且激活成功
- pause
- echo 接下来请输入CorelDRW的文件绝对路径,比如
- echo D:\Program Files\Corel\CorelDRAW Graphics Suite X7\Programs64\CorelDRW.exe
- echo 那么就输入
- echo D:\Program Files\Corel\CorelDRAW Graphics Suite X7\Programs64
- echo 把后面的.exe文件去掉只要前面的路径,注意没有最后的斜杠!!!
- echo.
- echo.
- set /p dir=复制过来路径输入然后回车:
- echo 你输入的是%dir%
- echo 继续启用防火墙并且写入规则...
- pause
- netsh advfirewall set currentprofile state on
- netsh advfirewall firewall add rule name="PsiService_2" dir=in action=block program="%ProgramFiles%\Common Files\Protexis\License Service\PsiService_2.exe"
- netsh advfirewall firewall add rule name="PsiService_2" dir=out action=block program="%ProgramFiles%\Common Files\Protexis\License Service\PsiService_2.exe"
- netsh advfirewall firewall add rule name="DIM.EXE" dir=in action=block program="%dir%\DIM.EXE"
- netsh advfirewall firewall add rule name="DIM.EXE" dir=out action=block program="%dir%\DIM.EXE"
- netsh advfirewall firewall add rule name="CorelPP.exe" dir=in action=block program="%dir%\CorelPP.exe"
- netsh advfirewall firewall add rule name="CorelPP.exe" dir=out action=block program="%dir%\CorelPP.exe"
- netsh advfirewall firewall add rule name="CorelDRW.exe" dir=in action=block program="%dir%\CorelDRW.exe"
- netsh advfirewall firewall add rule name="CorelDRW.exe" dir=out action=block program="%dir%\CorelDRW.exe"
- netsh advfirewall firewall add rule name="CdrConv.exe" dir=in action=block program="%dir%\CdrConv.exe"
- netsh advfirewall firewall add rule name="CdrConv.exe" dir=out action=block program="%dir%\CdrConv.exe"
- netsh advfirewall firewall add rule name="Capture.exe" dir=in action=block program="%dir%\Capture.exe"
- netsh advfirewall firewall add rule name="Capture.exe" dir=out action=block program="%dir%\Capture.exe"
- netsh advfirewall firewall add rule name="Cap.exe" dir=in action=block program="%dir%\Cap.exe"
- netsh advfirewall firewall add rule name="Cap.exe" dir=out action=block program="%dir%\Cap.exe"
- netsh advfirewall firewall add rule name="BarCode.exe" dir=in action=block program="%dir%\BarCode.exe"
- netsh advfirewall firewall add rule name="BarCode.exe" dir=out action=block program="%dir%\BarCode.exe"
- pause
- goto menu
-
- :sc_3
- cls
- echo.>>C:\Windows\System32\drivers\etc\hosts
- echo.>>C:\Windows\System32\drivers\etc\hosts
- echo 127.0.0.1 apps.corel.com>>C:\Windows\System32\drivers\etc\hosts
- echo 写入host完毕,程序即将退出
- pause
- exit
复制代码
|