Solved

Batch file to detect running program

Posted on 2011-02-23
3
730 Views
Last Modified: 2012-05-11
Hi All,

I have a app which was written by a developer who has since lft our company. From time to time, the app decides to stop working and close without error or warning.

I was think that it might be possible to have a batch file which runs on an hourly basis which checks to see if the app is still running, if not send an alert. Ive already got the alert process sorted by using something called BLAT which is a simly little utlility which when called, sends an email to a distribution list on our exchange server.

Has anyone got a simply batch file which can check to see if a process/application is running and then call my BLAT process?

I can confirm the app is listed in the Task List and within the Applications Running Tab of the Task Manager.

Thanks
DW
0
Comment
Question by:daiwhyte
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Assisted Solution

by:OrenRozen
OrenRozen earned 250 total points
ID: 34960643
create a batch file named lookfor.cmd (or what you'd like) using the following code

to run it : lookfor OUTLOOK.EXE

NOTE: make sure the application have the exact name as shown in tasklist

@echo off

:again
echo looking..
for /F "tokens=1" %%a in ('tasklist ^| find /I "%1"') DO if "%%a"=="%1" goto Yes
echo app not runningn
goto :end

:Yes
echo app running

:end

Open in new window

0
 
LVL 55

Accepted Solution

by:
Bill Prew earned 250 total points
ID: 34966612
Give this a try as your BAT file thatyou schedule.

@echo off
set Image=imagename.exe
set Found=N
tasklist /fi "imagename eq %Image%" | find /i "%Image%" >NUL && set Found=Y
if "%Found%" EQU "N" (
  REM Do email logic here
)

Open in new window

~bp
0
 

Author Closing Comment

by:daiwhyte
ID: 34969046
Thank you both.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question