0

requirement is to capture the following information in a single log file every 5 minutes for 4 processes (7005.exe, 7006.exe, 7007.exe, 7008.exe).

filename, memory used (kb), Cpu%, timestamp 7005.exe, 10240, 75, 10:30 AM 7006.exe, 10240, 75, 10:30 AM 7005.exe, 10242, 75, 10:35 AM 7006.exe, 10000, 75, 10:35 AM

I tried using task list but I am no good at command file scripting.

Please advise,

Thanks.

user606093
  • 121
  • 1
  • 2
  • 9

3 Answers3

0

do you want something like sysinternals psList ?

dvhh
  • 4,724
  • 27
  • 33
0

Check out Windows Management Instrumentation, and the tasks/process API in particular. There's an example on that page for gathering process CPU info via the Process object.

Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
0

I have used these commands in a batch file, the only issue I have is to capture time the app name and memory usage. Any words of advise on how to capture date and time in the same line of the process?

echo %Date% %TIME% >> c:\ym\tasklist.log

tasklist /fi "memusage gt 100000" >> c:\tasklist.log

The output:

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
explorer.exe                   476 Console                    2    189,384 K
Maxthon.exe                   8104 Console                    2    275,540 K
OUTLOOK.EXE                   5320 Console                    2    189,992 K
Tue 10/09/2012 15:17:00.20 

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
explorer.exe                   476 Console                    2    187,936 K
Maxthon.exe                   8104 Console                    2    275,520 K
OUTLOOK.EXE                   5320 Console                    2    190,076 K
Tue 10/09/2012 15:19:00.35 

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
explorer.exe                   476 Console                    2    188,044 K
Maxthon.exe                   8104 Console                    2    300,520 K
OUTLOOK.EXE                   5320 Console                    2    190,080 K

The challenge for me is to bring the time-stamp next to each process. Someone advise please.

CrazyTim
  • 6,695
  • 6
  • 34
  • 55
user606093
  • 121
  • 1
  • 2
  • 9