Last active
March 10, 2019 12:18
-
-
Save ezhov-da/8b09443b702a1947f1624528772c2462 to your computer and use it in GitHub Desktop.
vbs загрузка файла из нета.vbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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