通过vbs获取远程host文件并保存到指定目录
Subdownload(url,target)
ConstadTypeBinary=1
ConstadTypeText=2
ConstadSaveCreateOverWrite=2
Dimhttp,ado
Sethttp=CreateObject("Msxml2.ServerXMLHTTP")
http.SetOption2,13056
http.open"GET",url,False
http.send
Setado=createobject("Adodb.Stream")
ado.Type=adTypeBinary
ado.Open
ado.Writehttp.responseBody
ado.SaveToFiletarget,adSaveCreateOverWrite
ado.Close
EndSub
SetWshShell=CreateObject("WScript.Shell")
WinDir=WshShell.ExpandEnvironmentStrings("%WinDir%")
HostsFile=WinDir&"\System32\Drivers\etc\Hosts_google"
Consthosts="https://raw.githubusercontent.com/vokins/simpleu/master/hosts"
downloadhosts,HostsFile
经测试,由于网络问题,可能获取会超时,建议大家多运行几次。或加入脚本可执行时间。
热门推荐
1 狗狗技能训练
5 如何训练狗狗笑
6 狗狗训练排便
9 狗狗响片训练
10 如何训练狗狗不捡食
11 狗狗尿训练
12 怎么训练狗狗找东西
13 狗狗训练站立
14 狗狗训练飞盘
15 鞍山狗狗训练
16 怎样训练泰迪狗狗谢谢
17 狗狗外出训练
18 怎么训练金毛狗狗大小便