Solved

VBScript logic to wait for a child process to end

Posted on 2010-11-09
3
2,942 Views
Last Modified: 2012-08-14
Hi,
I'm writing a VBScript wrapper to manage an application install. I've used
     wshShell.run setup.exe,0,True
to launch the executable.  The problem is that setup.exe spawns _setup.exe, then setup.exe terminates.  Is there a method to wait until all spawned processes terminate?
Thanks.
0
Comment
Question by:netrxinc
3 Comments
 
LVL 16

Accepted Solution

by:
jmatix earned 500 total points
ID: 34096943
One option is to do a winmgmts query on process with name '_setup.exe' and wait until the process count is zero.


wshShell.run setup.exe,0,True

set svc=getobject("winmgmts:root\cimv2")
sQuery="select * from win32_process where name='_setup.exe'"

Do
set cproc=svc.execquery(sQuery)
If cproc.count = 0 Then
	Exit Do
End If
WScript.Sleep 1000
Loop

Open in new window

0
 
LVL 13

Expert Comment

by:Daz_1234
ID: 34100643
Hi netrxinc,

While the 2nd process _setup.exe is still running, open a command prompt and run:

wmic process get commandline | find /i "_setup.exe"

This will list the processes called _setup.exe but will show the complete command line used to call it.

Then once you have the command line, try calling that (the _setup.exe) from your vbscript instead of the main Setup.exe.

(by the way this isn't anything to with SAP is it?)

Good luck,
Daz.
0
 

Author Closing Comment

by:netrxinc
ID: 34111881
Thanks.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

785 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