WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: limnos on November 16, 2018, 08:52:34 AM

Title: Is there a way to copy a file from a web link?
Post by: limnos on November 16, 2018, 08:52:34 AM
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.
Title: Re: Is there a way to copy a file from a web link?
Post by: krasdude on November 16, 2018, 09:52:51 AM
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/WinHttpRequest+Download~a~Binary~File.txt is one way I beleive
Title: Re: Is there a way to copy a file from a web link?
Post by: limnos on November 16, 2018, 11:18:38 AM
Yup, that's the ticket.  Thanks, just wasn't searching in the right place.
Title: Re: Is there a way to copy a file from a web link?
Post by: grantwilson on January 15, 2019, 10:40:35 PM
Quote from: limnos on November 16, 2018, 08:52:34 AM

Re: Is there a way to copy a file from a web  (http://forum.winbatch.com/index.php?topic=2127.msg11071#msg11071)link (https://hireessaywriter.org/)?

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.
Title: Re: Is there a way to copy a file from a web link?
Post by: stanl on January 16, 2019, 03:49:25 AM
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.