How to convert a tasklist's CPU time to CPU % usage?

It doesn't look like there's an easy way to do this with tasklist, so I would suggest either doing this in VBscript or another scripting language, or using a different approach. If you're constrained to batch files then you could use the WMIC command to get the list of running processes with their respective CPUTime:

C:\> wmic path Win32_PerfFormattedData_PerfProc_Process get Name,PercentProcessorTime

Name                 PercentProcessorTime
Idle                 0
System               0
Smss                 0
csrss                0
winlogon             0
services             0
lsass                0


wmiprvse             100
wmic                 0
_Total               100

Note that this in my testing showed wmipsrv.exe as having 100% CPU, because it spiked while executing the WMI query. You should account for that in your script or you'll end up trying to kill the WMI service constantly ;)


tasklist does not tell you how long the process has been running for. It tells you how much CPU time the various processes have taken up. To get a percentage (and that will be an average percentage) you need to know how long your process has been running for. You could for instance take snapshots 10 seconds apart, subtract the times, then find the process CPUTIME which is nearest to the number 10. (Well 10 times the number of CPU cores? not sure...)