Joe
Thu Dec 04 16:53:31 CST 2003
Hi,
"Joe Public" <Joe@home> wrote in message
news:ufcdKqquDHA.3496@TK2MSFTNGP11.phx.gbl...
| Hello,
|
| I need to run a sequence of exes on a remote machine and am using
| Win32_Process:Create to launch them. The script must sleep/loop until each
| exe finishes before launching the next one.
| When the exe is launched, I get the PID for the process; how can I code a
| loop to check when the process has ended?
|
| TIA
The following is air code, but it might be something like:
set oWMI= getObject( _
"winmgmts:{impersonationLevel=impersonate}!\\" _
& sCptrName & "\root\cimv2")
... 'launch and get nPid= pid
do
wscript.sleep 100 'if WSH hosted
qFnd= false
for each oProcess in oWMI.instancesOf( _
"Win32_Process")
qFnd= (oProcess.processId=nPid)
if qFnd then exit for
next
loop while qFnd
Joe Earnest
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 09-23-03