Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to download an image file from a website using PowerShell or from Windows command line?

Tags:

powershell

cmd

I'm trying to download an image from the internet using a command prompt like PowerShell or the Windows command line.

I tried running this line that I found online:

wget http://imgur.com/ -OutFile out.jpg

That's an example, not the actual parameters that I used.

I ran this in PowerShell, but I get

System.UnauthorizedAccessException

I'm not very experienced in the command line and don't know what to do from here.

like image 604
Trocadero Avatar asked Oct 16 '25 18:10

Trocadero


1 Answers

Use Invoke-WebRequest:

Invoke-WebRequest -Uri https://i.imgur.com/XoSe08F.jpg -OutFile test.jpg -UseBasicParsing

In case of Edge or Internet Explorer is not installed use the -UseBasicParsing switch, otherwise Invoke-WebRequest might fail.

like image 107
Moerwald Avatar answered Oct 18 '25 13:10

Moerwald



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!