How to download, install and use WGET in Windows

How to download, install and use WGET in Windows

Have you ever experienced the terrible feeling that one of your website’s most important elements has vanished?

Perhaps you need to switch web hosts, and you’ll need to download and back up things like photos or CSV files. Maybe it’s a static website, and you need to create an HTML archive of all the pages. You might need to replicate a resource on the Internet in some fashion, but you’re not sure what tools are available to do it.

It’s probable that you’ll need to learn how to utilize WGET as a result.

WGET is a command-line utility for downloading files and crawling webpages. WGET is a set of commands that allow you to download files (even in poor network conditions) and includes features such as the ability to resume broken downloads.

There are plenty of tips on how to use WGET, a free network program for retrieving files from the World Wide Web using HTTP and FTP, if you’re a Linux user, but there are significantly less precise guides for doing so in Windows 10.

Unless you want to install Ubuntu or buy a Mac, here’s a quick way to setting up WGET on Windows.

What does WGET Do?

The WGET program, once installed, allows you to download files using the TCP/IP protocols FTP, HTTP, and HTTPS.

If you’re using Linux or Mac, WGET is either already included in the package you’re using, or it’s a simple matter of installing it with a single command from whatever repository you like.

However, under Windows, it’s not quite as straightforward (but it’s still extremely simple!).

You must manually download, unzip, and install WGET in order to use it.

Install WGET in Windows 10

Download the ancient 32-bit version 1.14 here, or go to Eternally Bored’s Windows binaries collection for newer versions and faster 64-bit builds.

The zip file for version 1.2 64 bit. can be downloaded here.

You’ll need to learn about path variables in Windows to figure out where to copy your new executable if you want to be able to launch WGET from any directory inside the command prompt. You can make WGET a command that you can run from any directory in Command Prompt if you follow these steps.

Run WGET from anywhere

To begin, we must decide where WGET.exe should be copied.

Open a command terminal by typing “cmd” in the search menu after you’ve downloaded wget.exe (or unzipped the related distribution zip files):

We’ll put wget.exe under a Windows directory, which will allow us to launch WGET from anywhere.

To begin, we must determine which directory this should be. Type:

path

Something along these lines should be seen:

We know we need to copy wget.exe to the c:\Windows\System32 folder because of the “Path” environment variable.

Restart your Command Prompt after copying WGET.exe to the System32 directory.

Restart command terminal and test WGET

Restart your terminal and type: wget -h to see if WGET is working properly.

If you copied the file to the correct location, a help file with all of the possible instructions will display.

As a result, you should see something like this:

Now is the time to begin.

Get started with WGET

Given that we’ll be working in Command Prompt, we’ll make a separate download location for WGET files.

We’ll use the command md (“make directory”) to build a directory.

Change to the c:/ prompt and enter the following:

wgetdown md

Then, in your created directory, type “dir” to see the contents (blank).

You’re now ready to start downloading.

Example commands

After you’ve installed WGET and created a new directory, all you have to do now is learn some of the finer nuances of WGET arguments to ensure you receive exactly what you want.

For those who want to get down to the nitty-gritty, the Gnu.org WGET manual is a great place to start.

However, if you’re looking for some short commands, keep reading. I’ve provided WGET with instructions to recursively mirror your site, download all pictures, CSS, and JavaScript, localize all URLs (so the site works on your local system), and save all pages as.html files.

To mirror your site execute this command:

wget -r https://www.yoursite.com

To mirror the site and localise all of the urls:

wget --convert-links -r https://www.yoursite.com

To make a full offline mirror of a site:

wget --mirror --convert-links --adjust-extension --page-requisites --no-parent https://www.yoursite.com

To mirror the site and save the files as .html:

wget --html-extension -r https://www.yoursite.com

To download all jpg images from a site:

wget -A "*.jpg" -r https://www.yoursite.com

Set a different user agent:

For apparent bandwidth-saving reasons, some web servers block WGET’s default user agent. To get around this, you could try changing your user agent. Pretending to be Googlebot, for example:

wget –user-agent=”Googlebot/2.1 (+https://www.googlebot.com/bot.html)” -r https://www.yoursite.com

Wget “spider” mode:

Wget can download pages without saving them, which is important if you’re looking for broken links on a website. Remember to use recursive mode, which allows wget to examine the entire document for links to follow.

wget –spider -r https://www.yoursite.com

This can also be saved to a log file by adding the following option:

wget –spider -r https://www.yoursite.com -o wget.log

I hope you’ve enjoyed my tutorial on how to use this amazing tool. Please leave a comment!

 

 
Loading Facebook Comments ...