forked from brianfgonzalez/Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckIfRunning.vbs
More file actions
24 lines (23 loc) · 1.56 KB
/
CheckIfRunning.vbs
File metadata and controls
24 lines (23 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 2011
'
' NAME:
'
' AUTHOR: BrianG ,
' DATE : 11/27/2013
'
' COMMENT:
'
'==========================================================================
myProcess = "notepad.exe"
WScript.Echo "Checking for: " & myProcess
Do Until blnRunning = "False"
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = '" & _
myProcess & "'", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
WScript.Sleep 100 'Wait for 100 MilliSeconds
If colItems.Count = 0 Then 'If no more processes are running, exit Loop
blnRunning = False
End If
Loop