How to download files from command line in Windows like wget or curl
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Sunrise at the Stream
--
Chapters
00:00 Question
00:29 Accepted answer (Score 217)
01:19 Answer 2 (Score 379)
02:03 Answer 3 (Score 188)
02:42 Answer 4 (Score 78)
03:41 Thank you
--
Full question
https://superuser.com/questions/25538/ho...
Question links:
[Wget]: http://en.wikipedia.org/wiki/Wget
Accepted answer links:
[Wget for Windows]: http://eternallybored.org/misc/wget/
[Wget Wiki FAQ]: http://wget.addictivecode.org/Frequently...
[this section of FAQ]: http://wget.addictivecode.org/Frequently...
http://eternallybored.org/misc/wget/
http://gnuwin32.sourceforge.net/packages...
Answer 3 links:
https://techcommunity.microsoft.com/t5/c...
https://curl.haxx.se/windows
https://docs.microsoft.com/powershell/mo...
Answer 4 links:
[download a file with certutil]: https://isc.sans.edu/forums/diary/A+Susp.../
[Admin Tool Pack for windows server 2003]: https://www.microsoft.com/en-gb/download...
[BITSAdmin]: http://en.wikipedia.org/wiki/Background_...
[Here's my overview of how a file can be downloaded on windows without external tools]: https://stackoverflow.com/questions/2814...
--
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"); */