监控程序

By | 2021-09-08

这个也是个bat脚本,日常使用电脑过程中,经常会遇到部分程序被其他人关掉,这个脚本的目的是:定时检查程序是否在运行,如果程序被关闭或者没有运行,脚本文件会自动打开对应的程序,并循环扫描程序是否在运行。

源码:

@echo off
title Mr.wei PM
:again

tasklist|findstr -i “Netch.exe”
if ERRORLEVEL 1 (
echo Netch is off in %Date:~0,4%-%Date:~5,2%-%Date:~8,2% %Time:~0,2%:%Time:~3,2%
start “” “D:\Netch\Netch.exe”
)

tasklist|findstr -i “2345Pic.exe”
if ERRORLEVEL 1 (
echo 2345Pic is off in %Date:~0,4%-%Date:~5,2%-%Date:~8,2% %Time:~0,2%:%Time:~3,2%
start “” “D:\2345Pic\2345Pic.exe”
)

choice /t 10 /d y /n > nul

goto again