使用bat脚本判断mysql和redis是否存在 存在停止进程并删除进程
时间: 2023-03-25 21:01:49 浏览: 403
bat判断进程是否存在,存在结束进程.bat
5星 · 资源好评率100%
可以使用以下的bat脚本来判断mysql和redis是否存在,如果存在则停止进程并删除进程:
@echo off
tasklist /FI "IMAGENAME eq mysqld.exe" | find /i "mysqld.exe" > nul && (
echo Mysql is running.
taskkill /F /IM mysqld.exe > nul
del /F /Q "C:\Program Files\MySQL\MySQL Server 5.7\data\ib_logfile"
del /F /Q "C:\Program Files\MySQL\MySQL Server 5.7\data\ib_logfile1"
del /F /Q "C:\Program Files\MySQL\MySQL Server 5.7\data\ibdata1"
) || (
echo Mysql is not running.
)
tasklist /FI "IMAGENAME eq redis-server.exe" | find /i "redis-server.exe" > nul && (
echo Redis is running.
taskkill /F /IM redis-server.exe > nul
) || (
echo Redis is not running.
)
阅读全文