Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need to download a file through http from the command line on a windows server 2008. I am looking for something like wget, but it must be a built-in tool.

Is there such a tool?

share|improve this question
    
Is PowerShell a built-in tool for you? –  mailq Aug 15 '11 at 8:16
    
Yes, PowerShell is ok. –  steenhulthin Aug 15 '11 at 8:28

4 Answers 4

up vote 11 down vote accepted

If you have PowerShell installed...

(New-Object System.Net.WebClient).DownloadFile("http://icanhazip.com/","icanhazip.txt")
share|improve this answer
2  
Note for those not familiar with this call. The first argument is to the file to download, the second is what to save it as locally. –  John Apr 11 '12 at 14:43
2  
For some reason this wouldn't work for me until I included the path in where to save it locally: (New-Object System.Net.WebClient).DownloadFile("http://download.microsoft.com/download/8/C/5‌​/8C5EEDC7-3D72-4BB6-A55E-37F3977CD892/wpilauncher.exe","C:\wpilauncher.exe") –  Chris Magnuson Jun 27 '13 at 17:45

you use curl also: http://curl.haxx.se/docs/manpage.html

something like

curl -O http://domain.com/file.gz

should work

share|improve this answer
1  
curl is nice, but not built-in. –  steenhulthin Aug 15 '11 at 8:52

No wget equivalent that is built-in/default across Windows.

share|improve this answer

I would liek to use the powershell way, however, when used to get at some pages, like those with erronous ssl code (self signed, or other) you need to set the expectations first before the call

[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$wc = New-Object System.Net.WebClient

$wc.DownloadFile ( "https://thesite.com/myPage", "LocalFileName.htm" )

This in turn will fail too, if it redirects to many times, f.ex. if it needs cookies to keep etc etc...

So sadly, without writing a small executable on my own there doesnt seem to be something besides wget that really can handle all situations so far... would love to be wrong.

share|improve this answer
    
If you need cookies, you are probably breaking ToS by downloading it via CLI anyway. –  lVlint67 Jul 4 '13 at 13:20

protected by Community Aug 11 at 20:27

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.