批處理腳本監視進程資源

在 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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章