Windows DatabaseebooksStatistical Information

LWE10056 : Howto automate FTP with vbscript and windows scripting host for free


Difficulties automating FTP transfers




Some developers think they need a third-party tool or some complex source code to do FTP. There is an easier way to do FTP with scripting windows scripting host. The FTP executable from Windows has a command line option for running scripts.  You can schedule regular FTP scripts using Task Scheduler. (AT command)

You should make a text file for the script which can be used as parameter for the ftp command and and put your ftp command in it.

cd tfptest
cd download
mget testfile*

The script above would FTP to and do a logon with username and password. Then it changes directory and gets some testfiles. You can run this script in visual basic Script like:

Set objShell = CreateObject("WScript.Shell")

objShell.Run "cmd /c c:\winnt\system32\ftp.exe -s:filename" >> " & FTPLogfile, 1, True

Set objShell = Nothing

The FTPLogfile is optional and can be used to do some logging. We use this for automating ftp.


The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!
Copyright © 2004-2016 Lubby (V3.0.11 Jan 2016)
Sponsored by Keskon.
Datenschutzerklaerung - Privacy statement - Privacyverklaring