Using FTP Batch Scripts

ID: Q96269


The information in this article applies to:

FTP (file transfer protocol) is a file transfer utility commonly used with UNIX systems.

FTP is capable of using scripts (lists of commands from external files). The following example demonstrates a script that opens a connection to IP address 11.11.11.11, logs onto the host as a guest with the password guest, uploads the FILE1 file, and quits:
open 11.11.11.11 guest guest put file1 quit


You must use the -s option for FTP to read this file under Windows NT. If the previous script was in a file called TEST.SCR, you could start the script by typing the following:
ftp -s:test.scr


You can specify the host name in the command line and then use the script to process the login. For example, if you use the following command line:
ftp -s:test.scr 11.11.11.11


the script file should read as follows:
user guest guest put file1 quit


However, If the ftp host implements auto-login, this command will fail. You would turn off auto-login with a -n in the command line. The command line would then read as follows:
ftp -n -s:test.scr 11.11.11.11

Keywords          : kbinterop win95 NTInterop 
Version           : WinNT:3.1,4.0;Windows:95
Platform          : winnt 
Issue type        : kbinfo 

Last Reviewed: January 12, 1999