整理N年前写的cmd的进程守护工具。
@echo off
mode con cols=58 lines=18
color 02
title 微信开发者工具进程守护 【按Ctrl+C停止监控】
echo ╔----------------------------------------------╗
echo ┆此监控进程用于生产环境监控使用,一直开启即可!┆
echo ╚----------------------------------------------╝
:main
::----设置项开始-----
::检测时间间隔,单位:秒
set _interval=5
::初始进程数
set wechatnow=0
::最低进程数
set wechatmax=1
::监控进程名
set tasklist=wechatdevtools.exe
::启动目录
set start="D:\Program Files\Tencent\微信web开发者工具\"微信web开发者工具.exe
::----设置项结束-----
for /f %%i in ('tasklist /nh^|findstr /i /s /c:"%tasklist%"') do set /a wechatnow+=1
if %wechatnow% lss %wechatmax% (
echo 微信开发者工具有问题,重新开启
%start%
) else (
echo 微信开发者工具 运行正常
echo 微信开发者工具 当前进程数 %wechatnow%
)
echo %_interval%秒后再次检查
ping -n %_interval% 127.1>nul
goto main