0x0049 icon

download_file.vbs

0x0049 | PRO | 05/12/15 02:39:03 PM UTC | 0 ⭐ | 358 👁️ | Never ⏰ | []
VB.NET |

790 B

|

None

|

0 👍

/

0 👎

' Set your settings
    strFileURL = "URL"
    strHDLocation = "DOWNLOAD LOCATION"
 
' Fetch the file
    Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
 
    objXMLHTTP.open "GET", strFileURL, false
    objXMLHTTP.send()
 
If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject("ADODB.Stream")
objADOStream.Open
objADOStream.Type = 1 'adTypeBinary
 
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0    'Set the stream position to the start
 
Set objFSO = Createobject("Scripting.FileSystemObject")
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = Nothing
 
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
 
Set objXMLHTTP = Nothing
 
 
 
' run with cscript.exe download_file.vbs

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎