Is there a way to copy a file from a web link?

Started by limnos, November 16, 2018, 08:52:34 AM

Previous topic - Next topic

limnos

I need to copy a zip down from a link like this https://stuff.stuff.stuff/Content/doc/stuff.zip.  I'm sure I'm over looking some object call I can use.  I already leverage a subroutine to open a browser session with the Object.open("InternetExplorer.Application") call, so I assume there's some object I can use to copy a file from a browser location?  Any help or advise would be appreciated.  Thanks.


limnos

Yup, that's the ticket.  Thanks, just wasn't searching in the right place.

grantwilson

Quote from: limnos on November 16, 2018, 08:52:34 AM

Re: Is there a way to copy a file from a web link?

I need to copy a zip down from a link like this https://stuff.stuff.stuff/Content/doc/stuff.zip.  I'm sure I'm over looking some object call I can use.  I already leverage a subroutine to open a browser session with the Object.open("InternetExplorer.Application") call, so I assume there's some object I can use to copy a file from a browser location?  Any help or advise would be appreciated.  Thanks.

Hi there,

Is it possible to use Invoke-WebRequest with PowerShell 3.0 alternatively? I've been searching for the answer on Stackoverflow:
Invoke-WebRequest http://www.example.com/package.zip -OutFile package.zip


Thanks.

stanl

Of course you can. It may be a little slow depending on size of the zip. But if you want to keep it all in WB (especially if future operations on the zip are required) the HTTPS previously suggested will work, or you can leverage WB's CLR and use


System.Net.WebClient.DownloadFile(uri, output) -

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/getarticle.web+WinBatch/dotNet/System_Net+DownloadFile.txt

Then there is BITS - but someone with more knowledge will have to chime in and explain it.