在 windows 系统下,可以通过批处理脚本监视进程的资源使用情况,并且定时输出到文件中。
批处理脚本(xxx.bat)如下:
rem 设置输出文件的路径
set filePath=E:\xxx.txt
:start
rem 输出系统当前日期和时间
echo %date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2% >> %filePath%
rem 输出指定进程(cmd.exe)对应的资源使用
tasklist /fi "imagename eq cmd.exe" >> %filePath%
rem 延时10s
choice /t 10 /d y /n >nul
rem 换两行
echo. >> %filePath%
echo\ >> %filePath%
goto :start