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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vbscript calling Batch file with FTP Commands 1

Status
Not open for further replies.

ryanrat

IS-IT--Management
Oct 30, 2001
30
US
Hello,

I'm trying to call a batch file from vbscript. The batch file contains an ftp command which uses an ftp script.

I'm trying to get vbscript to wait until the transfer is completed before going onto the next step.

Function Upload(uploadBatchFile_PATH)
'Starts upload of files
dim sh
set sh = createobject("wscript.shell")
call sh.run(uploadBatchFile_PATH, 1, True)
End Function

But the rest of my script still runs.

Any help is much appreciated.
 
Does your batch wait for the FTP to complete before it exits? VBScript will only wait for the process that is the batch to complete. It won't watch for any processes that the batch starts to end.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
My batch file:

cd c:\photos
start /wait ftp -i -s:c:\ftp\upload.ftp
del /Q *.*

Is this what you mean?
 
That is what I mean. If you run the batch by itself, does it wait for the ftp to end?

Also, try making the command that kicks off the batch from vbscript kick off cmd.exe. Not just the batch itself. So if uploadBatchFile_PATH holds just the path and name of the batch, use this line to run it:
call sh.run("cmd.exe /c " & uploadBatchFile_PATH, 1, True)

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
I think I just had my functions called in the wrong order.

Sorry to waste your time!
 
Thanks for the star although I don't think I earned it. I owe you a freebie. :)

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top