Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wait for Process Termination

Status
Not open for further replies.

frankfisher

Programmer
Oct 17, 2003
5
US
Hi,

I'm new to VBScript, and am trying to automate the backup of our virtual servers. Basically, I need to know when my pkzipc operation completes.

This presents difficulty because WScript.Shell doesn't wait for termination before it continues, a feature the other %99.9 of the time.

My best guess is that if I can scan the process table for
pkzipc's running, I can safely decide if it's time to proceed.

Any thoughts on where I should look to figure this out? Is my method a viable one?

Thanks
Frank

"If only I could cron taking out the garbage"
 
try this
Dim WshShell
Dim Running
Set WshShell = CreateObject("WScript.Shell")

Set Running = WshShell.Exec("PROGRAMM YOU WANT TO RUN")

Do While Running.Status = 0 'Wait for prog to finish
WScript.Sleep 10000 'wait ten seconds
Loop

Set Running = Nothing
Set WshShell = Nothing
 
Try something like this:
Code:
Set Sh=WScript.CreateObject("WScript.Shell")
ReturnCode=Sh.Run("pkzipc " & YourArgList,1,True)


Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top