Solved

Batch file to detect running program

Posted on 2011-02-23
3
736 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 56

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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 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