Windows批处理 -- 打造MySQLCleaner
批处理打造MySQLCleaner
1. 简介
在我们卸载MySQL数据库的时候,往往除了需要卸载软件,还需要删除各种注册表信息,隐藏文件,卸载服务,否则当我们再次安装MySQL时就会出现一些令人难以理解的错误。所以为了简单起见,本人用批处理简单写了一个清理软件,基本上是默认安装路径的都可以一键清除,如果有特殊情况,可参照百度经验完全卸载mysql数据库图文教程,然后停止并删除服务即可。
2. 注意事项
请以管理员权限运行此程序!!
3. 代码样例
TITLE MySQLCleaner
@echo off
color 0e
echo Start Delete MySQL Process
echo @Author PeterZ
echo.
echo ____ ___ _ ____ _
echo / ___^| / _ \ ^| ^| / ___^| ^| ^| ___ __ _ _ __ ___ _ __
echo \___ \ ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| / _ \ / _` ^| ^| '_ \ / _ \ ^| '__^|
echo ___) ^| ^| ^|_^| ^| ^| ^|___ ^| ^|___ ^| ^| ^| __/ ^| (_^| ^| ^| ^| ^| ^| ^| __/ ^| ^|
echo ^|____/ \__\_\ ^|_____^| \____^| ^|_^| \___^| \__,_^| ^|_^| ^|_^| \___^| ^|_^|
echo.
echo [+] Start To Delete Regedit & echo.
reg delete HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL /f
echo[ [*] DETELE HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL
reg delete HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\Eventlog\Application\MySQL /f
echo[ [*] DETELE HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\Eventlog\Application\MySQL
reg delete HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\MySQL /f
echo[ [*] DETELE HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\MySQL
reg delete HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\MySQL /f
echo[ [*] DETELE HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\MySQL
reg delete HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\services\MySQL /f
echo[ [*] DETELE HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\services\MySQL
reg delete HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MySQL /f
echo[ [*] DETELE HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MySQL
echo.
echo [+] Start to Delete MySQL Service & echo.
net stop MySQL*
echo[ [*] STOP MYSQL SERVICE
sc delete MySQL*
echo[ [*] DELETE MYSQL SERVICE
echo.
echo [+] Start To Delete MySQL INI&Possible Install Files) Files
rd /s /q c:\Program Files\MySQL
echo[ [*] DELETE C:\Program Files\MySQL
rd /s /q c:\Program Files (x86)\MySQL
echo[ [*] DELETE C:\Program Files (x86)\MySQL
rd /s /q c:\ProgramData\MySQL
echo[ [*] DELETE C:\ProgramData\MySQL
rd /s /q c:\Windows\my.ini
echo[ [*] DELETE C:\Windows\my.ini
rd /s /q c:\Windows\MySQL
echo[ [*] DELETE C:\Windows\MySQL
rd /s /q c:\Windows\System32\Tasks\MySQL
echo[ [*] DELETE C:\Windows\System32\Tasks\MySQL
echo.
echo [+] Clean Process Over O(∩_∩)O~
echo.
echo [**] Please Restart the Computer ~
pause
本文为博主总结文章,欢迎转载,请注明出处。