This commit is contained in:
Li Wei 2023-08-18 21:45:42 +08:00
commit ebf0ec2f00
1 changed files with 26 additions and 0 deletions

26
自动杀进程.bat Normal file
View File

@ -0,0 +1,26 @@
@echo off
rem 定义需监控程序的进程名和程序路径,可根据需要进行修改
set /p AppName=请输入要监控的进程名:
echo.
echo 进程监控开始……
echo.
:startjc
qprocess | findstr /i %AppName%
for /f "tokens=4" %%a in ('qprocess ^|findstr %AppName%') do (
set pid=%%a
)
if %errorlevel%==0 (
echo 程序pid为%pid%
echo ^>%date:~0,10% %time:~0,8% 程序正在运行……
taskkill /f /pid %pid%
)else (
echo ^>%date:~0,10% %time:~0,8% 没有发现程序进程
)
rem 用ping命令来实现延时运行
for /l %%i in (1,1,1) do ping -n 1 -w 1000 168.20.0.1>nul
goto startjc
@echo on