How to download files from command line in Windows like wget or curl
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT
Music by Eric Matyas
https://www.soundimage.org
Track title: Horror Game Menu Looping
--
Chapters
00:00 How To Download Files From Command Line In Windows Like Wget Or Curl
00:17 Accepted Answer Score 224
01:02 Answer 2 Score 382
01:36 Answer 3 Score 81
02:26 Answer 4 Score 39
02:44 Thank you
--
Full question
https://superuser.com/questions/25538/ho...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #wget #curl
#avk47
ANSWER 1
Score 382
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.
ACCEPTED ANSWER
Score 224
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.
ANSWER 3
Score 81
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
ANSWER 4
Score 39
Save the following text as wget.js
and simply call
cscript /nologo wget.js http://example.com
This is the code:
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
WinHttpReq.Open("GET", WScript.Arguments(0), /*async=*/false);
WinHttpReq.Send();
WScript.Echo(WinHttpReq.ResponseText);
/* To save a binary file use this code instead of previous line
BinStream = new ActiveXObject("ADODB.Stream");
BinStream.Type = 1;
BinStream.Open();
BinStream.Write(WinHttpReq.ResponseBody);
BinStream.SaveToFile("out.bin");
*/