3

I'm struggling with the windows commandline for years. Is it possible to download a file over http(/https) with the programs that are shipped with windows by default?

I know that I can download or program additional software and add it to the %PATH% to do the job but I'm looking for a solution that works out of the box.

This program should be available on the home version of windows.

5
  • 1
    Well, there is no such program other than Internet Explorer (and that's not quite suitable). What's wrong with using wget from unxutils.sourceforge.net for example? May 11, 2012 at 22:56
  • I like it to use things I can find on any computer, without downloading things that should already be there (also it's pretty ironic that I would have to download a program if I want to be able to download things).
    – sfx
    May 11, 2012 at 23:05
  • I don't know every stackexchange board yet and I thought batch would be a stackoverflow question. Sorry for the mistake.
    – sfx
    May 11, 2012 at 23:07
  • What versions of Windows do you have in mind? Vista, 7 or also XP? May 12, 2012 at 18:14
  • bitsadmin.exe may be an option, depending on your version of Windows. I think it works for generic http downloads, i.e., even if the server doesn't support BITS, although I'm not certain. May 13, 2012 at 0:52

4 Answers 4

8

In Windows 7 and above:

open powershell.exe and type:

(New-Object System.Net.WebClient).DownloadFile("http://www.google.com/images/srpr/logo3w.png","C:\g.png")
2
  • Would this not also work in Windows XP and Vista, provided Powershell was installed?
    – kreemoweet
    May 12, 2012 at 22:13
  • Yes, it should work in XP and Vista but he didn't want to install anything. I was more concerned that PowerShell is not part of the Windows 7 Home Edition, but it seems it is. May 12, 2012 at 22:25
2

You could write a batch file to open iexplore.exe and load an URL, if the URL went straight to the download page. I don't think this is the best option (agree wget or curl would work more the way you seem to be looking for) but if you want to use OEM-only tools this is an option.

See Internet Explorer Command-Line Options

IE - Open website in multiple tabs - possible with .js file

Sometime back I wanted to open multiple websites in different tabs. I tried something like below

iexplore "microsoft.com" "msn.com" "whatever.com"

As you might have tried, that didnt work as expected. I found a .js script to do that for me. Here it is below. Have the script in a .js file. I couldnt locate where I found it from. But I am guessing that it was from Eric Lippert blog.

var navOpenInBackgroundTab = 0x1000;
var oIE = new ActiveXObject("InternetExplorer.Application");
oIE.Navigate2("http://blogs.msdn.com");
oIE.Navigate2("http://blogs.msdn.com/tonyschr", navOpenInBackgroundTab);
oIE.Navigate2("http://blogs.msdn.com/oldnewthing", navOpenInBackgroundTab);
oIE.Navigate2("http://blogs.msdn.com/ericlippert", navOpenInBackgroundTab);
oIE.Visible = true;

Save the above code in launchie.js. Double click. There you go.

2
  • Please learn how to format posts. Check their preview so that they really look like intended. You need to indent code by 4 spaces or by pressing Ctrl-K on the selected code. You also should quote anything you didn't write yourself by using the blockquote feature. Thank you.
    – slhck
    May 12, 2012 at 19:55
  • 1
    Well, I've obviously got a lot to learn about posting on here. Thanks for the information. I will educate myself before posting further.
    – calenti
    May 13, 2012 at 5:04
0

There is no "Windows-native" standalone .exe program that simply downloads a file via HTTP.

Internet Explorer exposes much of its functionality via COM components/objects, including HTTP/HTTPS dowloading, but this requires at least some scripting to use.

0

As previously stated, there is not. The best idea is to have a windows version of Wget on a USB stick, can do anything, but quite difficult to understand all its possible options.

Try the binaries provides by the gnuwin32 project: http://gnuwin32.sourceforge.net/packages/wget.htm

Although they seem to be a bit late on gnu releases.

You must log in to answer this question.