Solved

VBScript logic to wait for a child process to end

Posted on 2010-11-09
3
3,143 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

636 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