Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want a way to download a file via HTTP given its URL (similar to how wget works). I have seen the answers to this question, but I have two changes to the requirements:

  • I would like it to run on Windows 7 or later (though if it works on Windows XP, that's a bonus).
  • I need to be able to do this on a stock machine with nothing but the script, which should be text that could be easily entered on a keyboard or copy/pasted.
  • The shorter, the better.

So, essentially, I would like a .cmd (batch) script, VBScript, or PowerShell script that can accomplish the download. It could use COM or invoke Internet Explorer, but it needs to run without any input, and should behave well when invoked without a display (such as through a Telnet session).

share|improve this question
dload v1.0 a win32 command line tool like wget – seizu Oct 30 '14 at 16:52
Not a duplicate because this question is specifically looking for something that will run on a stock machine (without additional software, such as wget for Windows). – Jason R. Coombs Feb 1 '15 at 16:31
up vote 11 down vote accepted

If you have PowerShell >= 3.0, you can use Invoke-WebRequest:

Invoke-WebRequest -OutFile su.htm -Uri

Or golfed:

curl -outf su.htm
share|improve this answer

I would use BITS (primer):

Background Intelligent Transfer Service (BITS) is a component of modern
Microsoft Windows operating systems that facilitates prioritized,
throttled, and asynchronous transfer of files between machines using
idle network bandwidth.

Starting with Windows 7, Microsoft advises to use the PowerShell cmdlets for BITS.

% import-module bitstransfer
% Start-BitsTransfer http://path/to/file C:\Path\for\local\file

You could also use BITS via COM, see here for an example VBScript. And there is 'bitsadmin', a commandline tool to control downloads:

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

In Windows 7 bitsadmin.exe states itself that it is a deprecated tool. Nevertheless:

% bitsadmin.exe /transfer "NAME" http://path/to/file C:\Path\for\local\file
share|improve this answer
It appears now that bitsadmin is deprecated and may not be included in future versions of Windows. – Jason R. Coombs Feb 20 '12 at 14:11
@JasonR.Coombs: link? reference? – akira Feb 21 '12 at 6:06
2 ... so, instead of "bitadmin.exe" one just uses bits-cmdlets. – akira Feb 21 '12 at 6:24
thanks for that. All I had to go on was bitsadmin was telling me it was deprecated when I ran it. – Jason R. Coombs Feb 22 '12 at 12:27

Try the Web Client class. There is a sample PowerShell script at the bottom of this page:

$c = new-object
$r = new-object $c.OpenRead("")
echo $r.ReadToEnd()
share|improve this answer
This is helpful. I found the WebClient also has a DownloadFile method, which will download the content directly to a file. Thanks. – Jason R. Coombs Apr 10 '10 at 11:56

Copy and paste the following six lines (or just the last four lines) into a text file. Then rename it to vget.vbs.

'cscript vget.vbs >FILE.TXT
'Run this vbscript at command line. Use above syntax to download/create FILE.TXT
Set oX = CreateObject("Microsoft.XmlHTTP")
oX.Open "GET", "", False
oX.Send ""
WScript.Echo oX.responseText

Obviously you need to customize three things in this script to make it work for you.

  1. The part which says "". You will need to substitute the correct URL for the file you wish to download.
  2. The command you will run at the command line to execute this script; will need to specify the correct name for the script, vget.vbs, if that is what you called it.
  3. And the name FILE.TXT that you want the output to be directed to by a DOS batch command line.

I have only tried using this to download a raw ASCII text file (a more powerful cmd script) from my Dropbox account, so I don't know if it will work for EXE files, etc.; or from other webservers.

If you dispense with the first two comment lines, it is only four lines long. If you know your way around VBScript you might even be able to carry this code around in your head, and type it into the command line as needed. It only contains five key command components: CreateObject, .Open, .Send, WScript.Echo and .responseText.

share|improve this answer

Here's my attempt to resume the ways of how file can be downloaded on Windows without usage of external tools.

It includes BITSADMIN, Microsoft.XmlHTTP and WinHTTP with a hybrid batch/JScript script that does not need temp files, and System.Net.WebClinet with self-compiled hybrid.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .