How to know whether program is running or not by javascript, vbscript or perl?

Posted on 2004-11-03
Medium Priority
Last Modified: 2010-05-02
I like to monitor some program's status whether individual program is running or not in order to invoke again or kill the program. Because some of them is not running as a service in the windows OS, I don't know how to get program name or process name of that program.
Process ID is always changed so I cannot use PID.
What is the function or script that I can you to know the status of program to control?

Question by:young_nacs
LVL 32

Accepted Solution

Erick37 earned 1200 total points
ID: 12488176
You can use WMI to list all of the processes currently running:

Dim oProcess

For Each oProcess In GetObject("winmgmts:root\cimv2").ExecQuery("Select * from Win32_Process")
    'List the running processes name + the ProcessID
    Debug.Print oProcess.Name, oProcess.processid


WMI Reference:
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 12492174
'put this code in the starting form , make exe of the Project and try by running the Exe
Private Sub Form_Load()

 If App.hInstance Then
     MsgBox "Application is already Running"
 End If

End Sub


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month16 days, 7 hours left to enroll

850 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