amp.cmd

本文介绍了一个批处理脚本,该脚本用于启动和重启 Apache HTTP Server 和 MySQL 数据库服务。通过使用 tasklist 和 taskkill 命令,脚本能够检查服务是否正在运行,并在必要时终止它们,然后重新启动这些服务。此脚本适用于 Windows 环境,对于需要频繁重启服务的场景非常有用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

@echo off
:begin
tasklist | findstr /c:httpd.exe > nul
if "%errorlevel%" == "0" echo %errorlevel% > nul && taskkill /f /im httpd.exe > nul && echo [httpd service stop]
tasklist | findstr /c:mysqld.exe > nul
if "%errorlevel%" == "0" echo %errorlevel% > nul && taskkill /f /im mysqld.exe > nul && echo [mysqld service stop]

pause
cls
cmd /c start cmd /c start /min D:\amp\httpd-2.4.25-x86\Apache24\bin\httpd.exe && echo {httpd service start}
cmd /c start cmd /c start /min D:\amp\mysql-noinstall-5.0.96-win32\mysql-5.0.96-win32\bin\mysqld.exe && echo {mysqld service start}
pause
cls

:loop
tasklist | findstr /c:httpd.exe > nul
if "%errorlevel%" == "0" echo %errorlevel% > nul && taskkill /f /im httpd.exe > nul && echo [httpd service stop]

pause
:eof
cls
cmd /c start cmd /c start /min D:\amp\httpd-2.4.25-x86\Apache24\bin\httpd.exe && echo {httpd service start}
tasklist | findstr /c:httpd.exe > nul
if "%errorlevel%" == "0" echo {mysqld service start}
pause
cls
goto loop

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值