WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Process ID

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to get CPU usage from a Task Manager Window

Keywords: 	  CPU usage Task Manager  Process Information Extender

Question:

How can I get CPU usage from a task manager window

Answer:

Look in the Process Information Extender help file, at the function tBrowseCntrs. This function will launch perfmon.exe, and you can select which process you want to monitor.

For CPU Usage, select, "% Processor Time", and hit the OK button. Then in the following script, you'll see that tGetData returns the total CPU time, either as an integer value or as a floating point number.

;Addextender("wproc34i.dll")
Addextender("wwprc44i.dll")

counterstring=tBrowseCntrs (0,0,0,0,0)
Message("tBrowseCntrs returned full counter path",counterstring)
if WinVersion(4)==4; NT
   intdat=tGetData(counterstring,0)
   fltdat=tGetData(counterstring,1)
   Message("tGetData for %counterstring%",strcat("Float Value:",fltdat,@CRLF,"Int Value: ",intdat))
endif

Article ID:   W14547
Filename:   Get CPU Usage.txt
File Created: 2017:07:28:13:58:38
Last Updated: 2013:04:01:09:08:49