How to download files from command line in Windows like wget or curl

How can I download something from the web directly without Internet Explorer or Firefox opening Acrobat Reader/Quicktime/MS Word/whatever?

I'm using Windows, so a Windows version of Wget would do.


Wget for Windows should work.

From the Wget Wiki FAQ:

GNU Wget is a free network utility to retrieve files from the World Wide Web using HTTP and FTP, the two most widely used Internet protocols. It works non-interactively, thus enabling work in the background, after having logged off.

From this section of FAQ, download links are suggested:

Windows Binaries

  • courtesy of Jernej Simončič: http://eternallybored.org/misc/wget/

  • from sourceforge: http://gnuwin32.sourceforge.net/packages/wget.htm

  • [...]

Link with courtesy of Jernej Simončič is used instead.


An alternative I discovered recently, using PowerShell:

$client = new-object System.Net.WebClient
$client.DownloadFile("http://www.xyz.net/file.txt","C:\tmp\file.txt")

It works as well with GET queries.

If you need to specify credentials to download the file, add the following line in between:

$client.Credentials =  Get-Credential                

A standard windows credentials prompt will pop up. The credentials you enter there will be used to download the file. You only need to do this once for all the time you will be using the $client object.


cURL

Windows 10 includes curl.exe:

https://techcommunity.microsoft.com/t5/containers/-/ba-p/382409

so you can do something like this:

# example 1
curl.exe --output index.html --url https://superuser.com
# example 2
curl.exe -o index.html https://superuser.com

If you have older Windows, you can still download it:

https://curl.haxx.se/windows

PowerShell

# example 1
Invoke-WebRequest -OutFile index.html -Uri https://superuser.com
# example 2
iwr -outf index.html https://superuser.com

https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest


It's possible to download a file with certutil:

certutil.exe -urlcache -split -f "https://download.sysinternals.com/files/PSTools.zip" pstools.zip

Certutil is not installed by default on XP/Win2003 but is avaialble on the newer windows versions.For XP/2003 you'll need the Admin Tool Pack for windows server 2003


Old answer:

Windows has its own command line download utility - BITSAdmin:

BITSAdmin is a command-line tool that you can use to create download or upload jobs and monitor their progress.

Here's my overview of how a file can be downloaded on windows without external tools

And a complete bitsadmin example:

bitsadmin /transfer myDownloadJob /download /priority normal http://downloadsrv/10mb.zip c:\10mb.zip