Description:
Useful when we want to wait for a process to complete until we continue execution of a script.
Source:
NA
Script:
This script waits until notepad.exe and iexplore.exe are no longer running:
dim svc : set svc=getobject("winmgmts:root\cimv2")
dim sQuery : sQuery="select * from win32_process where name='notepad.exe' OR name='iexplore.exe'"
Do
dim cproc : set cproc=svc.execquery(sQuery)
If cproc.count = 0 Then
Exit Do
End If
WScript.Sleep 1000
Loop