Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ezhov-da/8b09443b702a1947f1624528772c2462 to your computer and use it in GitHub Desktop.
Save ezhov-da/8b09443b702a1947f1624528772c2462 to your computer and use it in GitHub Desktop.
vbs загрузка файла из нета.vbs
'http://superuser.com/questions/59465/is-it-possible-to-download-using-the-windows-command-line
' Set your settings
strFileURL = "http://www.smartxls.com/SX.zip"
strHDLocation = "E:\SX.zip"
' 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment