0

I would like to know if there is a way to make a http download via batch script just with the standards programs in windows (XP and 7) and without PowerShell.

Please, don't give programs I need to install (unless I can install them via command line and without PowerShell).

Can someone please help me?

Edit:
I wanted to know if there is a way with batch script alone, without other types of scripts, I did not see that question but someone marked me as a duplicate...

Rafael
  • 111

3 Answers3

2

If you have access to network shares, you can use wget to download files from the command-line.

  1. Download the binaries and dependencies zip files from http://gnuwin32.sourceforge.net/packages/wget.htm.
  2. Extract them to a folder on a network share that your batch file will have access to.
  3. In your batch file, to download a file, put the following line:

    \\servername\sharename\wget.exe [URL]
    

The file will then be downloaded to the working directory, and you can then run your downloaded file in the batch script.

If you don't have access to network shares on the machines that these batch scripts are running on, just copy the wget files into the same folder as the batch script, and call it using:

wget.exe [URL]
Keith
  • 309
1

Of course, there is Internet Explorer, which does fit your description because it can be started from the command line, though that is interactive and probably not what you seek.

There may be objects, like WinHttp.WinHttpRequest.5.1 or XMLHTTP, that come with Windows and which can be used to grab a file via HTTP.

It can be used via WSH (Windows Scripting Host).

The number of lines you would need to type are numerous/complex enough that you'll probably just want to make a script and download it (which could be done using the built-in FTP command).

Although, if you're going to download your script, then is there really much advantage gained by downloading that script, rather than downloading a universal tool like cURL or wget?

(In my case, the answer was: yes. But your case might be different, so do think about that answer.)

Out of what comes with the operating system, that (WSH) has been the best solution that I've personally used so far, to accomplish HTTP through automation.

TOOGAM
  • 16,486
0

Bitsadmin.exe is a command-line tool that comes with Windows. It is a rather complex command, with a very large set of parameters/flags/options. The service it controls (Background Intelligent Transfer Service) is used by Windows itself to download update packages and such, but can be used to perform a simple file download from an arbitrary website.

kreemoweet
  • 4,742