How to monitor a Windows process and send an alert when it crashes or closes?

5,730
:begin
tasklist | find "java.exe"
IF %ERRORLEVEL% EQU 1  blat.exe ---
sleep 10
goto :begin

you'll need blat.exe which is the most used tool for sending mails via batch scripts sleep should be built-in windows 7. But this will work only if you have only one java.exe running... You can use some external tools to start a process and its PID for maximum usability

Share:
5,730

Related videos on Youtube

Disco
Author by

Disco

Updated on September 18, 2022

Comments

  • Disco
    Disco almost 2 years

    I'm looking for a program/utility to monitor a process running in Windows 7 (actually it's a Java process ran from .jnlp). and that can send an e-mail alert or trigger any kind of script so I can be aware that it has crashed ?

    From what i've seen there's nothing like that.

    Any ideas ?

  • Disco
    Disco almost 12 years
    Excellent ! Right what i was looking for; is it possible to get a .bat to run as a service ? I saw some applications around for .exe2service did you try .bat ?
  • Bhavini
    Bhavini almost 12 years
    may be this could help: runasservice.sourceforge.net
  • Disco
    Disco almost 12 years
    !!! I LOVE YOU :)
  • Sun
    Sun about 8 years
    I like bmail too: retired.beyondlogic.org/solutions/cmdlinemail/cmdlinemail.ht‌​m like blat but much leaner and smaller. free too.