美文网首页
VBS代码收集

VBS代码收集

作者: 米斯特Li_Xing | 来源:发表于2020-11-01 16:23 被阅读0次

vbs获取远程host文件并保存到指定目录

Sub download(url,target)
Const adTypeBinary = 1
Const adTypeText = 2
Const adSaveCreateOverWrite = 2
Dim http,ado
Set http = CreateObject("Msxml2.ServerXMLHTTP")
http.SetOption 2,13056
http.open "GET",url,False
http.send
Set ado = createobject("Adodb.Stream")
ado.Type = adTypeBinary
ado.Open
ado.Write http.responseBody
ado.SaveToFile target,adSaveCreateOverWrite
ado.Close
End Sub
Set WshShell=CreateObject("WScript.Shell")
WinDir =WshShell.ExpandEnvironmentStrings("%WinDir%")
HostsFile = WinDir & "\System32\Drivers\etc\Hosts_google"
Const hosts="https://raw.githubusercontent.com/vokins/simpleu/master/hosts"
download hosts,HostsFile

相关文章

网友评论

      本文标题:VBS代码收集

      本文链接:https://www.haomeiwen.com/subject/ydfuvktx.html