Home > Archive > VBScript > March 2004 > Downloading Files by VBS
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Downloading Files by VBS
|
|
| Martin M 2004-03-30, 8:31 am |
| Hi colleagues,
I have tried to use
=============
Option Explicit
Dim WSHShell, fso, f
Const DownloadFile = "http://www.sophos.com/downloads/ide/380_ides.zip"
Const TargetDir = "f:\"
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
fso.CopyFile DownloadFile , TargetDir
WScript.Quit
===============
But this does not work. The code is right and works with local files.
How can I download Files from the internet ?
Regards,
Martin
| |
| Robert Cohen 2004-03-30, 1:30 pm |
| wouldn't you need to use ftp instead http?
--
Robert Cohen
A legend in his own mind
--
"Martin M" <mmosisch@web.de> wrote in message
news:c4bp2d$2en2lh$1@ID-121690.news.uni-berlin.de...
> Hi colleagues,
>
> I have tried to use
> =============
> Option Explicit
> Dim WSHShell, fso, f
> Const DownloadFile = "http://www.sophos.com/downloads/ide/380_ides.zip"
> Const TargetDir = "f:\"
>
> Set WSHShell = WScript.CreateObject("WScript.Shell")
> Set fso = WScript.CreateObject("Scripting.FileSystemObject")
> fso.CopyFile DownloadFile , TargetDir
>
> WScript.Quit
> ===============
> But this does not work. The code is right and works with local files.
> How can I download Files from the internet ?
>
> Regards,
> Martin
>
>
| |
| Martin M 2004-03-30, 4:30 pm |
| You be me right, if I would be able to get the file by ftp but there is no
such facalty established.
But I am clever and I solved the problem by some workaround:
1) get the tool wget from www.wget.com
2) wirte a bat to download like
wget http://www.sophos.com/downloads/ide/ides.zip
3) run this "vbs glue" by
a) running the bat-file or
b) running by
Set WSHShell = WScript.CreateObject("WScript.Shell")
wshshell.Run wget http://www.sophos.com/downloads/ide/ides.zip
regards
"Robert Cohen" <dont@want.spam.com> schrieb im Newsbeitrag
news:%23DbPNknFEHA.700@TK2MSFTNGP09.phx.gbl...
> wouldn't you need to use ftp instead http?
>
> --
> Robert Cohen
> A legend in his own mind
> --
>
> "Martin M" <mmosisch@web.de> wrote in message
> news:c4bp2d$2en2lh$1@ID-121690.news.uni-berlin.de...
>
>
| |
|
| can be done
example
''''''''''''''''''''''''''''''''''''''''
''''''''
strSource
= "http://networking.us.uu.net/customer_support/pal/pal_4/n
ewf1.zip"
strDest = "c:\newf1.zip"
set HTTP = WScript.CreateObject("Microsoft.XMLHTTP")
HTTP.open "GET", strSource, False
HTTP.send
set Stream = createobject("adodb.stream")
Const adTypeBinary = 1
Const adSaveCreateNotExist = 1
Const adSaveCreateOverWrite = 2
Stream.type = adTypeBinary
Stream.open
Stream.write HTTP.responseBody
Stream.savetofile strDest, adSaveCreateOverWrite
set Stream = nothing
set HTTP = nothing
>-----Original Message-----
>You be me right, if I would be able to get the file by
ftp but there is no
>such facalty established.
>But I am clever and I solved the problem by some
workaround:
>1) get the tool wget from www.wget.com
>2) wirte a bat to download like
> wget http://www.sophos.com/downloads/ide/ides.zip
>3) run this "vbs glue" by
> a) running the bat-file or
> b) running by
> Set WSHShell = WScript.CreateObject
("WScript.Shell")
> wshshell.Run wget
http://www.sophos.com/downloads/ide/ides.zip
>
>regards
>
>
>
>
>"Robert Cohen" <dont@want.spam.com> schrieb im Newsbeitrag
>news:%23DbPNknFEHA.700@TK2MSFTNGP09.phx.gbl...
= "http://www.sophos.com/downloads/ide/380_ides.zip"[color=darkred]
("Scripting.FileSystemObject")[color=darkred]
with local files.[color=darkred]
>
>
>.
>
|
|
|
|
|