Win commands help automate downloading

Win commands help automate downloading

Every day, the Internet is becoming more influential to the way business is done. You might think that some of the Windows tools used to transfer files across the Net would be easier to find and use.

Most of us who surf the Web have probably clicked a link on a Web site to download a shareware utility, a text file, or some other resource. But most Web users probably don't know about a simple way to automate the process of downloading (or uploading) files.

For this task, Microsoft includes in Windows 98, Windows NT, and Windows 2000 a program called ftp. This program supports the File Transfer Protocol, or FTP, an Internet standard for moving data from one place to another. When you click a Web link to download a file, it's likely that the transfer is done using FTP.

Unfortunately, ftp is a text-mode command, and there's nothing in the Windows 98 Help system that mentions anything about ftp. The program is listed in the Windows NT and Windows 2000 Help, but there's almost nothing about using it to automate your routine tasks.

Reader Bob Nolte finds the automation aspects of ftp extremely useful. He's the owner of Personal Computers for You (, a consultancy in Minnesota.

Nolte uses ftp to download weekly updates of antivirus definition files for his clients' networks. To automate the process on networks that may support hundreds of PCs, he uses a tiny script file on NT Server.

If you've never used the ftp program, its command-line syntax looks like this: ftp {options} {-s:filename} {hostname}For details about this syntax, open a DOS window and type ftp -? (using /? doesn't work).

Or type ftp into the Index box in Windows NT or 2000 Help, then click Display.

Typing ftp at a command-line prompt starts an FTP session. You can then type commands interactively to connect to a remote host, access its resources, and then disconnect using the bye command. In order to use ftp, you must be using a computer that has the TCP/IP protocol installed.

Nolte uses a small batch file called download.bat, which automates his antivirus updates. This batch file connects to an Internet host that we'll call

In the batch file shown below, the FTP program reads a script file called down.txt. That script downloads an antivirus definition file called update.exe. All of this is logged to another text file called ftp.log. Nolte can check this log to make sure everything worked properly.

The contents of download.bat look like this:d:cd \dataecho Start of download>ftp.logftp -s:down.txt>ftp.logecho End of download>ftp.logIn the above batch file, the redirection sign (>) in line 3 creates a new ftp.log text file. In lines 4 and 5, the append sign (>) adds output text to this file.

Nolte's script file, down.txt, contains the following commands, which ftp executes on the remote host. The first two lines enter an ID and password. The script then changes directories, downloads update.exe, closes the session with the host, and exits.anonymousme@nonet.comcd pub/softwarelcd d:\databinhashget update.execlosebyeNolte points out that this method is just as useful for uploads as it is for downloads.

This makes it handy for any situation in which you must exchange files with a host regularly.

I'd like to hear from readers about your use of this capability. Send me e-mail using the word "ftp" as the subject line.

Follow Us

Join the newsletter!


Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.


ARN Innovation Awards 2022

Innovation Awards is the market-leading awards program for celebrating ecosystem innovation and excellence across the technology sector in Australia.

EDGE 2022

EDGE is the leading technology conference for business leaders in Australia and New Zealand, built on the foundations of collaboration, education and advancement.

Show Comments