Logging Memory usage and timestamp by Application

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
yasar2002
Posts: 4
Joined: 03 Oct 2012 07:29

Logging Memory usage and timestamp by Application

#1 Post by yasar2002 » 09 Oct 2012 23:53

Thanks guys,
Please refer to the commands in the batch file below:

Batch
=====

echo %Date% %TIME% & tasklist /fi "memusage gt 100000" >> c:\ym\tasklist.log

OUTPUT:
=======

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 timestamp next to each process. Someone advise please. How can I just get the output in this format:

Time..............................................Imagename.....Memusage
Tue 10/09/2012 15:17:00.20......explorer.exe....189,384 K

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Logging Memory usage and timestamp by Application

#2 Post by foxidrive » 10 Oct 2012 00:01

See how this goes.

Code: Select all

@echo off
for /f "skip=1 tokens=1,4,* delims=," %%a in (
'tasklist /fi "memusage gt 100000" /fo csv'
) do echo %date% %time% %%a %%c
pause

yasar2002
Posts: 4
Joined: 03 Oct 2012 07:29

Re: Logging Memory usage and timestamp by Application

#3 Post by yasar2002 » 10 Oct 2012 03:13

Foxidrive, you did it. Brilliant. Thanks alot it works as I expected.

Post Reply