pl-q
Goto Top

Datei downloaden vbs

Hi,
ich möchte mit VBS eine datei per HTTP herunterladen.
Hab es vorher damit versucht, kam aber eine Fehlermeldung :
Set wshshell = CreateObject("WScript.Shell")  
eigenedateien = wshshell.SpecialFolders("mydocuments")  

' hier ANPASSEN!  
quelle = "http://wininfo.de/help.gif"  
ziel = eigenedateien & "\test.gif"  

DownloadHTTP quelle, ziel
wshshell.Run """" & ziel & """"  

function DownloadHTTP(quelle, ziel)
   'SYS: XML OM für Win32  
Set HTTP = WScript.CreateObject("Microsoft.XMLHTTP")  
   'SYS: Microsoft (r) Script Runtime  
Set fs = WScript.CreateObject("Scripting.FileSystemObject")  
   
   HTTP.open "GET", quelle, False  
   HTTP.send
   datei = HTTP.responseBody
   For x = 0 to UBound(datei)
      binary = binary & ChrW(AscW(Chr(AscB(MidB(datei,x+1,1)))))
   Next
   
   Set file = fs.CreateTextFile(ziel, True)
   file.Write binary
   file.Close
   DownloadHTTP = HTTP.StatusText
End function
Hoffe ihr könnt mir weiterhelfen...

Content-Key: 82492

Url: https://administrator.de/contentid/82492

Printed on: April 18, 2024 at 15:04 o'clock

Mitglied: 60730
60730 Mar 06, 2008 at 16:12:09 (UTC)
Goto Top
Moin, was war denn die Fehlermeldung?

Muß es unbedingt VBS sein?

Für sowas nehm ich persönlich lieber wget und ein batch script face-wink
Member: PL-q
PL-q Mar 06, 2008 at 18:02:24 (UTC)
Goto Top
Zeile: 18
Zeichen: 4
Fehler: The system cannot locate the resource specified.
Code: 800C0005
Quelle: msxml2.dll
_____________________________________________

Das wäre der Fehler.
Ja ich hätte es schon gern in vbs, aber wie wäre der code in batch??
Mitglied: 60730
60730 Mar 06, 2008 at 18:24:29 (UTC)
Goto Top
Wget Windows
http://xoomer.alice.it/hherold/wget-1.10.2b.zip

Beispielbatch

wget -N -o c:\help.gif http://wininfo.de/help.gif

Der Parameter -N steht für - nur Dateien, die neuer, als die lokal vorhandenen herunterladen, -o wohin die Datei soll.