How to install wget on windows

How to install wget on windows

How to download your website using WGET for Windows

1st January 2019

How to download, install and use WGET in Windows

Ever had that terrifying feeling you’ve lost vital assets from your website?

Perhaps you need to move to a new web host and there’s some work to do to download and back up files like images or CSV files. Perhaps it’s a static website and you need to make an archive of all pages in HTML. Perhaps you need to mirror a resource on the Internet in some way but you’re not sure what tools are available to make that happen.

It’s possible, then that you need to learn how to use WGET.

WGET is a free tool to download files and crawl websites via the command line. WGET offers a set of commands that allow you to download files (over even quite bad network conditions) with features that mean you can do useful things like resume broken downloads.

If you’re a Linux user, there are lots of guides out there on how to use WGET, the free network utility to retrieve files from the World Wide Web using HTTP and FTP, but far fewer accurate guides to doing so in Windows 10.

Unless you fancy installing Ubuntu or buying a Mac, here’s a handy guide to installing and using WGET in Windows.

What does WGET Do?

Once installed, the WGET command allows you to download files over the TCP/IP protocols: FTP, HTTP and HTTPS.

If you’re a Linux or Mac user, WGET is either already included in the package you’re running or it’s a trivial case of installing from whatever repository you prefer with a single command.

Unfortunately, it’s not quite that simple in Windows (although it’s still very easy!).

To run WGET you need to download, unzip and install manually.

Install WGET in Windows 10

Download the classic 32 bit version 1.14 here or, go to this Windows binaries collection at Eternally Bored here for the later versions and the faster 64 bit builds.

Here is the downloadable zip file for version 1.2 64 bit.

If you want to be able to run WGET from any directory inside the command terminal, you’ll need to learn about path variables in Windows to work out where to copy your new executable. If you follow these steps, you’ll be able to make WGET a command you can run from any directory in Command Prompt.

Run WGET from anywhere

Firstly, we need to determine where to copy WGET.exe.

After you’d downloaded wget.exe (or unpacked the associated distribution zip files) open a command terminal by typing “cmd” in the search menu:

How to install wget on windows. Смотреть фото How to install wget on windows. Смотреть картинку How to install wget on windows. Картинка про How to install wget on windows. Фото How to install wget on windows

We’re going to move wget.exe into a Windows directory that will allow WGET to be run from anywhere.

First, we need to find out which directory that should be. Type:

You should see something like this:

How to install wget on windows. Смотреть фото How to install wget on windows. Смотреть картинку How to install wget on windows. Картинка про How to install wget on windows. Фото How to install wget on windows

Thanks to the “Path” environment variable, we know that we need to copy wget.exe to the c:\Windows\System32 folder location.

Go ahead and copy WGET.exe to the System32 directory and restart your Command Prompt.

Restart command terminal and test WGET

If you want to test WGET is working properly, restart your terminal and type:

If you’ve copied the file to the right place, you’ll see a help file appear with all of the available commands.

So, you should see something like this:

How to install wget on windows. Смотреть фото How to install wget on windows. Смотреть картинку How to install wget on windows. Картинка про How to install wget on windows. Фото How to install wget on windows

Now it’s time to get started.

Get started with WGET

Seeing that we’ll be working in Command Prompt, let’s create a download directory just for WGET downloads.

To create a directory, we’ll use the command md (“make directory”).

Change to the c:/ prompt and type:

Then, change to your new directory and type “dir” to see the (blank) contents.

How to install wget on windows. Смотреть фото How to install wget on windows. Смотреть картинку How to install wget on windows. Картинка про How to install wget on windows. Фото How to install wget on windows

Now, you’re ready to do some downloading.

Example commands

Once you’ve got WGET installed and you’ve created a new directory, all you have to do is learn some of the finer points of WGET arguments to make sure you get what you need.

The Gnu.org WGET manual is a particularly useful resource for those inclined to really learn the details.

To mirror your site execute this command:

To mirror the site and localise all of the urls:

To make a full offline mirror of a site:

To download all jpg images from a site:

For more filetype-specific operations, check out this useful thread on Stack.

Set a different user agent:

Some web servers are set up to deny WGET’s default user agent – for obvious, bandwidth saving reasons. You could try changing your user agent to get round this. For example, by pretending to be Googlebot:

Wget “spider” mode:

Wget can fetch pages without saving them which can be a useful feature in case you’re looking for broken links on a website. Remember to enable recursive mode, which allows wget to scan through the document and look for links to traverse.

You can also save this to a log file by adding this option:

Enjoy using this powerful tool, and I hope you’ve enjoyed my tutorial. Comments welcome!

webfolderio/wget-windows

Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Windows binaries of GNU Wget 1.21.3

How to install wget on windows. Смотреть фото How to install wget on windows. Смотреть картинку How to install wget on windows. Картинка про How to install wget on windows. Фото How to install wget on windows

A command-line utility for retrieving files using HTTP, HTTPS and FTP protocols.

GNU Wget is a free software package for retrieving files using HTTP, HTTPS, FTP and FTPS the most widely-used Internet protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, cron jobs and terminals.

How to use wget

Please read the official GNU Wget manual from the below link.

wget is built on GitHub Actions and cross compiled with mingw64 (Ubuntu & GNU/gcc 9.3). It’s virus-free and safe to use.

All required libraries is statically linked, and it’s not necessary to use third-party DLL.

Wget windows bundled with all wget features except nls (multi-lang version).

Follow these steps to build wget for windows on WSL 1 or 2 (Debian/Ubuntu).

How to Use wget Command With Examples

Home » SysAdmin » How to Use wget Command With Examples

What is wget?

Wget is a free GNU command-line utility tool used to download files from the internet. It retrieves files using HTTP, HTTPS, and FTP protocols.

It serves as a tool to sustain unstable and slow network connections. If a network problem occurs during a download, this helpful software can resume retrieving the files without starting from scratch.

Another important aspect is its capability of recursive downloads, with which it mirrors websites. It transfers parts of a website by following links and directory structure, thus creating local versions of webpages.

The wget command is also highly flexible and can be used in terminals, scripts, and cron jobs. During the download, the user does not have to be active nor logged in. As wget is non-interactive, it can independently run in the background.

Read this article to learn how to use some of the most common wget commands.

How to install wget on windows. Смотреть фото How to install wget on windows. Смотреть картинку How to install wget on windows. Картинка про How to install wget on windows. Фото How to install wget on windows

How to Check if wget is Installed?

Most likely, the wget package is already on your system as it now comes pre-installed on most Linux distributions.

To check, open the terminal window and type in:

If you have the wget software, the output tells you that the wget command is missing a URL, as shown in the image below:

How to install wget on windows. Смотреть фото How to install wget on windows. Смотреть картинку How to install wget on windows. Картинка про How to install wget on windows. Фото How to install wget on windows

wget Command Not Found

If the output displays wget command not found you need to download and install the tool manually. Below you will find the installation instructions for Ubuntu/Debian, CentOS, and Windows.

How to Install wget on Ubuntu/Debian?

To install wget on Ubuntu or Debian releases, use the command:

How to Install wget on CentOS/Fedora?

To install wget on CentOS or Fedora, type the following command:

How to Install wget on Windows?

To install and configure wget for Windows:

Introduction to wget Syntax

The wget syntax has the following pattern:

Each [option] has its long and short form which are conveniently interchangeable. This attribute specifies what to do with the URL that follows.

[URL] is the address of the file or directory you wish to download.

wget Command Examples

Download File from Web

To download a file from the web use:

For example, to install Tomcat 9, first you need to download the package with wget using the command:

Download File and Save Under Specific Name

To download a file and save it under a specified name run:

The wget command allows you to rename files prior to downloading them on your computer.

For instance, you may want to install Terraform. To download the package and rename it terraform.zip use the following command:

Download File to Specific Directory

By default wget downloads a file in the directory the user is in. To save the file in a different location, add the -P option:

For example, while installing Git on Ubuntu, you can download the package in the /temp directory with the command:

Set Download Speed

You can set the download speed when downloading a big file, so it does not use the full available bandwidth. The download speed is defined in kilobytes (k) and megabytes (m). Use the command:

For example, if you are installing NVIDIA TESLA drivers on Linux and want to limit the download speed to 1 megabyte, would use the command:

Note: If you are looking to install Nvidia drivers, visit our tutorials:

Continue Download After Interruption

Instead of having to start from scratch, wget can resume downloading where it stopped before the interruption. This is a useful feature if there is a lost of connection while downloading a file.

For instance, you may want to install a Mumble Server on Linux and suddenly lose internet connection while downloading the installation file. To continue downloading, type in the command:

Download Multiple Files

wget allows downloading multiple files at the same time using the command:

To do so, follow the steps outlined below:

1. First, create and open a file under the name MultipleDownloads.txt (or a name of your choice), using a text editor. In this case, we used Nano:

2. Once in the editor, add the URLs of the packages you want to download, one per line.

How to install wget on windows. Смотреть фото How to install wget on windows. Смотреть картинку How to install wget on windows. Картинка про How to install wget on windows. Фото How to install wget on windows

3. Save and exit the file.

4. Run the following wget command in the terminal window:

This prompts wget to download from each URL in the text file.

Download Web page (Mirror Web page)

With wget you can download an entire website from the internet, using the -m option. It prompts wget to create a mirror of the specified webpage. The basic command for doing so is:

Download via FTP

To download via FTP, type in the username and password of the FTP server, followed by the ftp address:

Download in Background

You can download in the background, a practical feature when dealing with a large file:

You can check the status of the download with the command:

Increase Retry Attempts

You can set how many times wget attempts to download a file after being interrupted by a bad network with:

By default, the number of retry attempts is set to 20.

You can also set the number to infinity with the values 0 or inf, as in the following example:

Skip Certificate Check

By default, wget checks whether the server has a valid SSL/TLS certificate. If it does not identify an authentic certificate, it refuses to download.

The —no-check-certificate option is used to avoid certificate authorities checking for a server certificate. However, utilize it only if you are sure of the website’s credibility or are not worried about security issues it may cause.

If http://enteratonerisk.com has an untrusted certificate, but will not harm the system, you can download it with:

Change User Agent

When downloading a webpage, wget essentially emulates a browser. In some cases, the output might say you don’t have permission to access the server, or that the connection is forbidden. This may be due to a website blocking client browsers that have a specific “User-Agent.”

“User-Agent” is a header field that the browser sends to the server it wants to access. Therefore, to download from a server that is refusing to connect, try to modify the user agent.

Find a database of all user agents online, search for the one you need and run the command:

For example, to emulate Chrome (version 74), you would change the user agent with the command:

Note: Make sure you always download from a trusted source because wget can instruct a download of a script from a malicious source. We outline this and many other dangerous commands in our article 14 Dangerous Linux Terminal Commands.

This article sums up why wget is such a powerful tool for downloading files over the internet. It also serves as a good reference for beginners with its list of 12 essential wget commands and examples.

How do I install Wget for Windows?

However, when I opened the command line and typed:

I only got an error message. Since I am using Chinese version of XP at the moment and I don’t read Chinese, I don’t understand what this message is saying, but I assume it means that Wget didn’t install properly.

So, how do I properly install Wget on Windows XP?

5 Answers 5

It sounds like you’re using Windows. To download a pre-built wget.exe for Windows, see WGET for Windows.

In the box near the top of the page, wget.exe is a link to download the wget program itself. Since this is an exe file already, there’s no need to unzip or install this particular version.

What you downloaded previously was the source code to wget, so you would need a compiler to build a wget for your system. This is probably not what you wanted.

A pre-built binary 32-bit version of wget for Windows (currently version 1.11.4-1) can be found on SourceForge at:

You have the choice of downloading the wget package as a setup program or a zip file. As described on the SourceForge download page, here is the difference:

If you download the Setup program of the package, any requirements for running applications, such as dynamic link libraries (DLL’s) from the dependencies as listed below under Requirements, are already included. If you download the package as Zip files, then you must download and install the dependencies zip file yourself. Developer files (header files and libraries) from other packages are however not included; so if you wish to develop your own applications, you must separately install the required packages.

I chose to install wget with the objective for checking for broken links. Here is a bat file I created to drive wget to do so:

Wget для Windows. Установка и использование.

В данной статье я хочу поговорить о установке и использовании консольной утилиты GNU Wget в операционной системе Windows.

Возможности Wget не ограничиваются одной лишь загрузкой архивов, утилита умеет создавать локальные копии web-сайтов с полным сохранением структуры каталогов и файлов. Помимо этого возможна конвертация сохраненных html-файлов для просмотра сайта в автономном режиме. Считывая заголовки файлов и сравнивая их с ранее загруженными файлами, Wget может загружать новые версии файлов, благодаря чему можно создавать обновляемые зеркала сайтов.

Wget может работать по протоколам HTTP, HTTPS, FTP, а также поддерживает работу через HTTP-прокси сервера. Утилита разрабатывалась для медленных соединений, точнее в те времена соединения были медленными и нестабильными, поэтому она поддерживает докачку файлов при обрыве соединения. Если сервер с которого загружался файл тоже поддерживает докачку, то Wget продолжит загружать файл именно с того места, где оборвалась загрузка.

Для того чтобы установить Wget, перейдите по ссылке и скачайте установочный exe-файл. Запустите exe-файл и установите Wget как обычную программу, по умолчанию утилита устанавливается C:\Program Files (x86)\GnuWin32.

Для запуска утилиты нужна командная строка Windows, запускаем ее через меню пуск или сочетанием клавиш Win+R, в открывшемся окне ввести «cmd» и нажать Enter. После запуска командной строки сразу пользоваться Wget, как это происходит в ОС Linux, не получится, сначала нужно указать местоположение файла wget.exe.

Файл wget.exe находится в каталоге bin, внутри установочной директории. Для указания файла используется команда path.

Теперь можно запустить Wget, для начала можно просмотреть вывод команды help со списком дополнительных опций.

Список дополнительных опций утилиты Wget под спойлером.

Обычные копирование и вставка (Ctrl+C, Ctrl+V) в командной строке Windows не работают. Чтобы скопировать текст из командной строки Windows, нужно просто выделить нужный фрагмент текста и нажать Enter.

Для вставки текста в командную строку, нужно кликнуть правой кнопкой мыши по окну командной строки, выбрать подменю «Изменить» и дальше выполнить требуемую команду. Копирование и вставка существенно облегчают работу с командной строкой Windows.

Давайте рассмотрим несколько примеров использования утилиты Wget.

Допустим что нам нужно скачать какой нибудь файл, пусть это будет титульное изображение для этой статьи. Для этого нужно просто указать URL (ссылку) нужного файла, например так.

Иногда Wget может ругаться на «самоподписанные сертификаты» при использовании HTTPS-ссылок, хотя с самими сертификатами все в порядке, в таком случае нужно использовать дополнительную опцию «—no-check-certificate».

При обычном вызове командной строки Windows сохранение файла будет происходить в пользовательский каталог C:\Users\Username. Если файл требуется сохранить в какой-либо определенный каталог, то его необходимо указать при помощи дополнительного ключа «-P», пусть это будет каталог test на диске C (C:\test).

Если файл должен быть сохранен в определенном каталоге, то существует более простой способ сохранения файла, без указания дополнительных опций. Зайдите в нужный каталог через проводник Windows, зажмите клавишу Shift и кликните по области каталога правой кнопкой мыши, в открывшемся меню выберите «Открыть окно команд».

Открывшаяся командная строка станет выглядеть следующим образом.

Выполните команду path, для указания местоположения wget.exe.

Теперь все будет сохраняться именно в эту папку.

Давайте представим что у нас есть некий файл со списком ссылок, которые необходимо скачать. Пусть это будет файл test.txt расположенный в пользовательском каталоге C:\Users\Username, со следующим содержанием.

Чтобы скачать сайт целиком достаточно просто указать его адрес c минимально необходимым набором опций, например.

В результате получим готовое зеркало сайта, которое будет автономно работать на компьютере, благодаря конвертации ссылок для локального использования сайта.

Но допустим что нам не нужен весь сайт, а только вот эта статья https://techlist.top/install-wordpress/. В таком случае команда для загрузки станет выглядеть так.

Комбинируя набор доп. опций в командах Wget можно добиться разных результатов. Так что пробуйте все самостоятельно и изучайте возможности утилиты.

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *