通过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
经测试,由于网络问题,可能获取会超时,建议大家多运行几次。或加入脚本可执行时间。
热门推荐
10 小红书平安祝福语简短
11 生日祝福语大全女孩简短
12 收生日红包祝福语 简短
13 领证幽默祝福语简短
14 法考面试祝福语简短
15 老哥出门祝福语简短语
16 送灯祝福语简短独特
17 幼儿狗年祝福语大全简短
18 好听的元旦简短祝福语