Board logo

标题: [原创] VBS自动下载hosts,上google 网站必备 [打印本页]

作者: lufeng369    时间: 2013-5-27 17:05     标题: VBS自动下载hosts,上google 网站必备

  1. Sub download(url,target)
  2. Const adTypeBinary = 1
  3. Const adTypeText = 2
  4. Const adSaveCreateOverWrite = 2
  5. Dim http,ado
  6. Set http = CreateObject("Msxml2.ServerXMLHTTP")
  7. http.SetOption 2,13056
  8. http.open "GET",url,False
  9. http.send
  10. Set ado = createobject("Adodb.Stream")
  11. ado.Type = adTypeBinary
  12. ado.Open
  13. ado.Write http.responseBody
  14. ado.SaveToFile target,adSaveCreateOverWrite
  15. ado.Close
  16. End Sub
  17. Set WshShell=CreateObject("WScript.Shell")
  18. WinDir =WshShell.ExpandEnvironmentStrings("%WinDir%")
  19. HostsFile = WinDir & "\System32\Drivers\etc\Hosts"
  20. Const hosts="https://smarthosts.googlecode.com/svn/trunk/hosts"
  21. download hosts,HostsFile
复制代码

作者: CrLf    时间: 2013-5-27 17:25

看起来很实用的样子,收藏了,谢谢分享
作者: jzp820927    时间: 2013-6-19 14:37

好东西啊,还准备自己写个呢,现在可以直接用了。




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2