Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VBScript logic to wait for a child process to end

Posted on 2010-11-09
3
Medium Priority
?
3,302 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:
Justin Mathews earned 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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 is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

879 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