在 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