Sorry I didn't read properly, you've already tried something almost like that. Not sure if you'll have any further luck with the method above.
Chris
Main Topics
Browse All TopicsExecuting a shell command from an ASP page using:
Set oWsh = Server.CreateObject("WScri
Set oExec = Server.CreateObject("Scrip
Set oExec = oWsh.Exec(sExecCommand)
...other statements
...
...
...
The shell command executes a ZIP utility which creates an archive about 500MB large (so this takes a minute or two).
I need to wait for the Exec method to complete before resuming with the next statements in the ASP page.
Problem 1: oWsh.Run(sExecCommand) freezes the ASP page, therefore doesn't work for me.
Problem 2: oWsh.Exec(sExecCommand) just runs through without waiting for the ZIP to finish whatever it's doing.
Problem 3: if I wait and sleep in a loop checking for eExec.AtEndOfStream, the page freezes
Problem 4: I look on the web server, the zip utility is running and then suddenly stops reading/writing. When I kill IIS, ZIP resumes and actually completes the operation.
Baffled!
How can I accomplish this?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I've done something like this:
sExecCommand = "cmd /c start /wait notepad.exe"
Set oWsh = CreateObject("WScript.Shel
Set oExec = CreateObject("Scripting.Fi
Set oExec = oWsh.Exec(sExecCommand)
Do While oExec.Status = 0
WScript.Sleep 1000
Loop
MsgBox "Finished"
I can leave notepad running for ten minutes, and when I close it, the command prompt closes, then the script continues.
I wonder if you can do a similar thing by using another program to execute the zip command line? Maybe you can explicity use:
"explorer.exe C:\progra~1\zip\zipcmd.exe
Regards,
Rob.
Business Accounts
Answer for Membership
by: Chris-DentPosted on 2007-04-25 at 12:29:39ID: 18976518
You'll need to check the status of Exec and wait. Something like this:
Do While oExec.Status = 0
WScript.Sleep 100
Loop
Status is 1 while the program is running.
HTH
Chris