How to download from command prompt?

Asked

Viewed 22,624 times

3

I’ve seen a lot of videos, but I don’t want to download that Wget. There’s no other way?

  • The wget works for me perfectly - I use Ubuntu. I believe that in your case, as a Windows user, it would have to be otherwise. Related: http://superuser.com/questions/59465/is-it-possible-to-download-using-the-windows-command-line

  • I find a valid doubt, since Ubuntu is so easy to do and we also do not have a Super User :)

2 answers

3

It seems that in the link to Superuser there are some answers, which are not directly by CMD.

So I’ll give you my suggestion:

PHP

PHP can also be used on the command line. We can then read a file through the readfile and save it in a files from your computer.

Behold:

> php -r "readfile('http://url_do_download');" > nome_do_arquivo_baixado.ext

CURL

Another way would be through the bash, which is always installed in the Windows when you install the git. Then you could use the curl as follows:

> curl http://url_do_download > nome_do_arquivo.ext

Observing: I don’t know if there’s any other way to install the bash in the Windows.

  • 2

    I think the information in the answer is clear enough

3


There are several ways to solve.

If you want something similar to *Nix systems, there is the wget for windows:

http://gnuwin32.sourceforge.net/packages/wget.htm

For those who are used to it, there is no secret.

wget http://endereço.do/arquivo/para.baixar

If you want to use native Windows features, you’ll find it in Powershell. A simple example:

Invoke-WebRequest http://endereço.do/arquivo/para.baixar -OutFile c:\foo.file

Note that within Powershell there are aliases, for example, wget is an alias for Invoke-WebRequest. The command line above can be written as follows

wget http://endereço.do/arquivo/para.baixar -OutFile c:\foo.file

Just note that the alias has nothing to do with the wget, popular on linux platforms.

Still on Powershell, another way to download:

(new-object System.Net.WebClient).DownloadFile( "http://endereço.do/arquivo/para.baixar", "c:\foo.file")
  • +1 for believing the question :)

  • -1 for ignoring that in the question I have already established that I do not want to use wget,@Wallacemaxters :)

  • @arfneto, I did not ignore the context of the question. I just explained that wget may already be native as an alias on the operating system in Powershell... The author wanted to avoid having to download a wget simulator from linux for windows.. I saw that it lacked knowledge on the subject using native windows features and so I responded in this way.. Now, it is unfair to negativate completely ignoring everything I answered there. If I had answered only "use wget," then yes, it would be fair to deny it.. Indeed, the author of the question himself defined the answer as satisfactory.

  • @Danielomine actually I didn’t "negatively" your answer. It was just an irony in the expression. But I understand what you said and you’re right.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.