Version 1.12 (February 2010)
Copyright © 2004-2010, Noël DANJOU
All rights reserved.
File Downloader is a small command-line tool that allows you to download one or more files from HTTP and FTP servers. It can be easily used in a script, a batch file or the Task Scheduler to automate file downloads.
Note: versions 1.10 and later are Unicode versions only which means that they only run in Windows 2000 and later. Windows 98 and ME are not supported anymore.
Table of Contents |
---|
Welcome |
Package Content |
Syntax |
Authentication |
Return Codes (ERRORLEVEL) |
Status Codes |
Known Issues |
History |
Latest Version |
Registration |
Redistribution |
Contact Details |
The File Downloader package is provided as a compressed (zip) archive that holds a few files. The included files are described in the table below.
File | Description |
---|---|
download.exe | File Downloader program. |
logenc.exe | Credentials Encoder program (see Authentication). |
wait.exe | Program whose purpose is to wait for a specified time period or until any key is pressed. It is similar to the TIMEOUT command in Windows Vista and later. It is used in the sample.bat example. |
sample.bat | Script that shows a way to use download.exe in a batch file. |
batch.txt | Sample text file that shows how to use the /batch parameter to download many files in one call. |
readme.htm | This file. |
license.htm | File only included with the full version. |
File Downloader features many parameters, for a whole list of the supported parameters and a description, type the following command in a Command Prompt:
download /?
The simplest syntax only requires the URL of the file or the resource to download, e.g.:
download http://www.server.com/file.zip
This command downloads the file.zip file from the webserver at www.server.com and places it in the current folder. This simple syntax may not be enough though. For example, you may get the following error:
Could not get file time on server.
In this case, you have to append the /notime parameter. Note that you may also specify this parameter if you want the filetime of the created file to be the one of the local system and not the one of the server.
The /overwrite parameter may also be required if you get the following error because the file already exists in the destination folder:
Could not create destination file.
The syntax would then look like this:
download http://www.server.com/file.zip /notime /overwrite
This syntax tells File Downloader to ignore the filetime of the file on the server and to overwrite any existing file.zip file in the current folder.
If the URL does not contain a filename and the server does not suggest one, you will get the following error:
An output filename is required
In this case, you can specify a filename using the /output parameter. You may also use the /output parameter to override a default or a suggested filename or to choose an alternate destination folder. Here is an example:
download http://www.server.com/download.php?res=1 /notime /overwrite /output:"c:\download\file.zip"
Notes:
download http://www.server.com/file.zip /credentials:"my login","my-password"
download http://www.server.com/file.zip /output:"%userprofile%\Desktop"or
download http://www.server.com/file.zip /output:..\backup
Unsupported Internet scheme: HTTP, HTTPS or FTP expected.
When authentication is required on the server, you can pass the login and password to the program, either as clear-text or in an encrypted form.
The clear-text login and password are simply passed as second and third parameters after URL, e.g.:
download <url> mylogin mypassword [...]
or using the /credentials parameter like this:
download <url> /credentials:mylogin,mypassword [...]
If you prefer to use encrypted credentials so that no one can see the login and password, you first have to create a credential file using the provided logenc.exe program. This program takes the login and password as parameters and optionally a credential filename. If no filename is specified, the default filename (credentials.dat) is used, e.g.:
logenc mylogin mypassword
or with an alternate output filename:
logenc mylogin mypassword server.bin
You can then use the credential file with download.exe, e.g.:
download <url> [...] /credentials:credentials.dat
or
download <url> [...] /credentials:server.bin
When File Downloader is used in a batch file, you can use ERRORLEVEL to check the completion code returned by the program. The possible return codes are listed in the table below. See the sample.bat example for a way to test the return codes.
Code | Description |
---|---|
0 | Success. |
1 | Syntax error or help/registration information displayed. |
2 | Download failed. |
3 | Invalid URL. |
4 | Destination file or folder error. |
5 | System error (e.g. out-of-memory). |
6 | Batch file error. |
The table below lists some of the status codes that may be reported when a download fails. The short description should give you some hints at what might be wrong.
For more information, please see Microsoft Knowledge Base article ID 943891.
Code | Description |
---|---|
400 | Syntax error. |
401 | Access denied. |
403 | Request forbidden. |
404 | Object not found. |
500 | Internal server error. |
download http://www.server.com/file.zip /referer:http://noeld.com
The latest demo version of File Downloader is always available for download from this address:
The demo version of this application only features a subset of the parameters supported by the registered version. When advanced parameters are used with the demo version, a REGISTRATION REQUIRED message will be displayed and the parameters will be ignored.
To register, click the link just below and follow the instructions.
https://www.regnow.com/softsell/nph-softsell.cgi?item=4076-9
Alternatively, you can type the following command in a Command Prompt to open the registration page in the default browser:
download /register
Orders and delivery are handled by the Register Now company.
Computer magazine publishers are welcome to redistribute the demo application as-is on their complimentary or monthly CDs. Any other redistribution of the application with commercial products is strictly forbidden without my written permission. Please contact me for a license agreement (see Contact Details).
E-mail: webmaster@noeld.com
WWW: http://noeld.com/