标题: [原创] VBS自动下载hosts,上google 网站必备 [打印本页]
作者: lufeng369 时间: 2013-5-27 17:05 标题: VBS自动下载hosts,上google 网站必备
- 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"
- Const hosts="https://smarthosts.googlecode.com/svn/trunk/hosts"
- download hosts,HostsFile
复制代码
作者: CrLf 时间: 2013-5-27 17:25
看起来很实用的样子,收藏了,谢谢分享
作者: jzp820927 时间: 2013-6-19 14:37
好东西啊,还准备自己写个呢,现在可以直接用了。
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |