想编写一个批处理,能监控tomcat6.exe这个进程占用的内存如果大于1024MB,就重启tomcat服务(系统服务)

2025-05-18 05:42:28
推荐回答(1个)
回答1:

:top
for /f "tokens=1-5 delims=, " %%a in ('tasklist /nh | findstr /i tomcat6.exe') do set s=%%e
if %s% GTR 1024 taskkill /f /im tomcat6.exe /t
ping -n 60 127.1>nul
goto top