Share this page 

Detect if a program is runningTag(s): WSH VBScript


Set WshShell = WScript.CreateObject("WScript.Shell")

Set locator = CreateObject("WbemScripting.SWbemLocator")
Set service = locator.ConnectServer()
Set props = service.ExecQuery _
   ("select name, description from Win32_Process where name = 'program.exe'")
num = props.Count

If num > 0 Then
   'Program is running
Else
   'Program is not running
End If

Set WSHShell = Nothing