日期:2014-05-17 浏览次数:20803 次
@echo off ::把需要监控的程序名去掉后缀名赋值给procname,比如监视记事本就是notepad set procname=notepad set cpath=Win32_PerfRawData_PerfProc_Process set fstr="Timestamp_Object Frequency_Object ElapsedTime" echo js=(WScript.Arguments(0)-WScript.Arguments(1))/WScript.Arguments(2)>tmp.vbs echo WScript.echo js>>tmp.vbs :loop for /f %%i in ('tasklist /nh^|find /c "%procname%.exe"') do (if %%i lss 1 goto loop) set Timestamp_Object= set Frequency_Object= set ElapsedTime= for /f "tokens=*" %%a in ('wmic path %cpath% where "name='%procname%'" get /value^|findstr /ib %fstr%') do (set %%a) if "%Frequency_Object%"=="" goto loop for /f %%b in ('cscript /nologo tmp.vbs %Timestamp_Object% %ElapsedTime% %Frequency_Object%') do (echo %%b) goto loop