Page 1 of 1

Monitoring Mem Usage of specific process on XP

Posted: 18 Jul 2012 08:11
by mr_wizard
Trying to keep something running in the background to monitor the memory usage (as seen in Process in Task Manager) of a specific process and when a specific size is met to create a dialog box with a message. So it would simply loop until it's found. I've tried several variations to no avail. Anyone mind taking a look? This is what I got:

:loop
Sleep 1
TASKLIST /FI "IMAGENAME eq explorer.exe" /FI "MEMUSAGE ge 30000"
if ERRORLEVEL 1 (goto :loop) else (goto :announce)

:announce
echo MSGBOX "Internet Explorer is not responding. Reference code: 1x000133t" > %temp%\TEMPmessage.vbs
call %temp%\TEMPmessage.vbs
del %temp%\TEMPmessage.vbs /f /q

exit


The way I test is simply modifying the size (i.e. 30000) which is denoted in KB's. I modify the size either intentionally larger or smaller (since the operation "ge" is greater than or equal) which does not effect whether the message occurs or not.

Thanks everyone!

Re: Monitoring Mem Usage of specific process on XP

Posted: 18 Jul 2012 08:22
by mr_wizard
Well found a work around, seems to be working.

:loop
Sleep 3
TASKLIST /FI "IMAGENAME eq explorer.exe" /FI "MEMUSAGE ge 6000" | find /i /c "explorer.exe"
if errorlevel 1 goto :loop
if errorlevel 0 goto :announce

:announce
echo MSGBOX "Internet Explorer is not responding. Reference code: 1x000133t" > %temp%\TEMPmessage.vbs
call %temp%\TEMPmessage.vbs
del %temp%\TEMPmessage.vbs /f /q

exit

Re: Monitoring Mem Usage of specific process on XP

Posted: 18 Jul 2012 09:48
by foxidrive
This should work too.

Code: Select all

:loop
Sleep 3
TASKLIST /FI "IMAGENAME eq explorer.exe" /FI "MEMUSAGE ge 6000" | find /i "explorer.exe" >nul || goto :loop
echo MSGBOX "Internet Explorer is not responding. Reference code: 1x000133t" > %temp%\TEMPmessage.vbs
call %temp%\TEMPmessage.vbs
del %temp%\TEMPmessage.vbs