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

Posted on 2004-11-03
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

    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
    '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

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Watch V8 10 34
    Window placement 17 56
    ms access #TYPE! error on report when no data 4 40
    add text to end of existing text in file 16 54
    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    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…

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now