根据命令行获取PID并杀死进程的bat脚本怎么写

2025-03-12 13:46:08
推荐回答(1个)
回答1:

@echo off
:1
tasklist | find "notepad.exe" >>c:\notepad.luowei
if exist c:\notepad.luowei taskkill /f /im notepad.exe
ping 127.1 -n 20 >nul 2>nul
goto 1

每隔20秒自动检测进程列表,自动关闭notepad.exe。