当前位置: 移动技术网 > IT编程>脚本编程>VBScript > vbs脚本实现下载jre包并静默安装的代码实例

vbs脚本实现下载jre包并静默安装的代码实例

2017年12月08日  | 移动技术网IT编程  | 我要评论

国足比赛时间,秋田犬多少钱,祸水弃妃倾天下

安装完成后可以回调,替换echo 123456789和pause就行了。

dim path
set ws = createobject("wscript.shell")
set fso=createobject("scripting.filesystemobject")
''定义安装路径
path = ws.expandenvironmentstrings("%windir%")+"\jre6\"
''创建目录
if (fso.folderexists(path)) then
else
  fso.createfolder(path)
end if
''文件下载
set xpost = createobject("microsoft.xmlhttp")
set sget = createobject("adodb.stream")
sub downloadtofile(url, file)
 xpost.open "get", url, false
 xpost.send
 sget.type = 1
 sget.open
 sget.write xpost.responsebody
 sget.savetofile file, 2
 sget.close
end sub
dim url
url = "http://xxx.com/jre-6-windows-i586.exe"
dim filename,batpath
filename = path+right(url, len(url) - instrrev(url,"/"))
downloadtofile url, filename
batpath = path+"start.bat"
set f=fso.createtextfile(batpath)
''写bat执行安装jre,完成后输出123456789,并暂停
f.write filename+" /s installdir="+path& vbcrlf&"echo 123456789"&vbcrlf&"pause"
f.close
''隐藏运行
ws.run(batpath),0,true

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网