Lead with Knowledge

Learn to secure your PCs from new and unknown hacker attacks.

Free IDC White Paper - Discover Secure File Sharing for the Enterpriseattacks.

Home  //  Article
Print Article    Email Article
Window Manager
Brian Livingston
Little-known Windows commands can help automate the process of downloading files

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 Eden Prairie, Minn.

Nolte uses ftp to download weekly updates of anti-virus 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 anti-virus 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 anti-virus 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:


cd \data

echo Start of download>ftp.log

ftp -s:down.txt>>ftp.log

echo End of download>>ftp.log

In 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.


cd pub/software

lcd d:\data



get update.exe



Nolte 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.

SUBSCRIBE TO:    E-mail Newsletters  InfoWorld Mobile InfoWorld Magazine
Home  //  Article Print Article    Email Article
Back to Top


FREE Storage Policy Management paper from BMC Software!
Download the J.D. Edwards CRM white paper. Visit
Introducing Primus Quick Resolve. Click to download a fact sheet.
Download the J.D. Edwards CRM white paper. Visit
Gateway: Your Reliable IT Provider of Business Technology Solutions

E-mail Newsletters
InfoWorld Mobile
Print Magazine

Web-based training

Copyright 2001 InfoWorld Media Group, Inc.