Guide to Windows Batch FTP

March 27th, 2010 by Nick Cruise

In order to access Window’s MS-DOS (Microsoft disk operating system) batch FTP, you need to first go to a DOS prompt, type FTP, and then hit enter. Once you’ve executed the program, then congratulations! You’ve just discovered the Windows-incorporated command-line FTP application that ships together with Windows NT or 95 and beyond. You can use this DOS-based FTP just like any other FTP client, except this time around, you need to at least have a basic understanding of how the old standard of MS-DOS works.

Scripting using FTP
FTP scripting is a relatively easy task. All you need to do is make a text document using FTP commands and use it to make your DOS-based FTP program do whatever you want without you manually entering each and every last command you need. For example, your script may contain the following commands:

open ftp.domain.com
mikesmith
t3n4y488
cd public_html
dir
get file.txt
bye

In order to execute the script if it were named “filetxtget.txt”, you should type:

ftp -s:filetxtget.txt

This script will help you login to the FTP site ftp.domain.com. Instead of waiting for a prompt for a username and password, the script itself will handle the details of your connection; you just need to substitute “mikesmith” for your username and “t3n4y488” for your password.

After you’ve logged in, the script will immediately access the public_html directory, retrieve a directory listing, and then utilize the “get” command to recover the file named file.txt. As soon as the file has been downloaded, the script will automatically log you off with the “bye” command. It’s that simple. At any rate, if you find Windows FTP’s scripting options sparse and limiting, consider using WinSCP.

Command Line Options for FTP
FTP has the following command-line options: “-v” represents the command that holds back the display of remote server responses. Meanwhile, “-d” activates the debugging feature, while “-i” deactivates interactive prompting whenever you’re doing numerous file transfers. Meanwhile, the “-s:filename” command (wherein “filename” represents the text file script you made) will automatically execute whatever commands are specified within your FTP script file after FTP starts.

Moreover, you shouldn’t confuse “-a” with “-A”. The lower case “-a” refers to the use of any local interface when you’re binding a data connection. In contrast, “-A” allows you to login to your FTP server anonymously. Furthermore, “-n” refers to auto-login suppression once an initial connection has been established, while “-w:buffer” refers to the override command for the default transfer buffer size of 4096. Finally, the “host” command allows you to know the IP address or host name of the remote host you’re connecting to.

Local FTP Commands
The local FTP commands you can use include the following: rmdir, open, lcd, close, rename, mput, help, cd, remotehelp, mls, hash, bye, verbose, recv, mkdir, glob, binary, user, quote, mget, get, bell, type, quite, mdir, disconnect, ascii, trace, pwd, mdelete, dir, append, status, put, ls, debug, ?, !, send, prompt, literal, and delete.

For many an administrator, having a built-in FTP program available on most DOS-based Windows operating systems is a very useful advantage. Unfortunately, it could also alienate modern PC enthusiasts because of their unfamiliarity with the old platform. Using FTP is hard enough as is, so adding the factor of it being in MS-DOS can make things a lot more complicated than they should be. Nevertheless, by educating yourself with basic FTP commands and streamlining the process with an FTP script, you should be able to use the program much easier and faster.

Comments are closed.