Download Files Using Wget Through Windows Command Prompt

The useful command line tool wget which is available in Linux can also be used in Windows. This tool can download web pages and files right from the command prompt.

First, download and install wget setup from here.

Wget setup for Windows

Once installed, it will be available in the bin folder.

To use it, open Windows command prompt (Win key + R and type cmd in the Run box) , then change the directory to this bin folder :

cd C:\Program Files\GnuWin32\bin>

wget directory in Windows

Downloading webpages and files : Using wget is simple. Enter a URL to specific file or a page that needs to be downloaded.

downloading webpage using wget in Windows

If the remote server allows it, then the contents can be downloaded. To exit, press Ctrl+C anytime.

To get an idea of available parameters that can be used with wget, type :

wget -h

 

wget help screen

There are commonly used options with wget which make it effective.

Resume interrupted downloads : To resume downloads when interrupted, use the -c parameter :

wget -c pathtofileorurl

In some cases where specifying a https url shows error, use the –no-check-certificate option.

Save downloaded files to specific folders :

By default, downloads are stored in Users\username\AppData\Local\VirtualStore\Program Files\GnuWin32\bin.

To save these to another path, use the directory-prefix with double dashes before it  :

wget –directory-prefix=<PATH>

So to save contents to a folder named Contents, simply give the full path as :

wget with download directory path specified

wget -c –directory-prefix=E:\Contents pathtofileorurl

The below example shows how files can be downloaded from Windows command prompt using wget. The destination folder where they will be saved is E:\Txdlds and the parameters specified include -c and –directory-prefix .

choosing a specific download folder when using wget in Windows

 

Batch downloading using an input file : wget can even parse for URLs from a file and then download from them automatically. This is through the -i parameter.

First, create a file with the links from where contents need to be downloaded.

using an input file for downloading files through wget

Next, include it when running wget. Specify the full path of this input text file just as in when choosing a download folder along with the previous parameters.

downloading from an input file using wget

All done.

 

Leave a Comment