1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
echo=1/*>nul&@cls @echo off title 常用+Youtube+Google by zephyr.vip echo. echo 备份原有hosts并下载最新hosts后替换。若执行失败,请右键【以管理员身份运行】 echo. pause set hosts=c:\Windows\System32\drivers\etc\hosts call :http "https://raw.githubusercontent.com/racaljk/hosts/master/hosts" 1 if not exist %hosts%_bak copy %hosts% %hosts%_bak copy 1 /b %hosts% /y >nul IF %ERRORLEVEL% EQU 1 ( echo 更换失败 ) ELSE ( echo 更换成功 ) echo. del /f /q 1 echo 3秒后关闭 ping -n 10 127.0.0.1>nul goto :eof rem 下载code来于网络 :http echo Start downloading. . . cscript -nologo -e:jscript "%~f0" "%~1" "%~2" echo Download OK! goto :eof */ var iLocal,iRemote,xPost,sGet; iLocal =WScript.Arguments(1); iRemote = WScript.Arguments(0); iLocal=iLocal.toLowerCase(); iRemote=iRemote.toLowerCase(); xPost = new ActiveXObject("Microsoft"+String.fromCharCode(0x2e)+"XMLHTTP"); xPost.Open("GET",iRemote,0); xPost.Send(); sGet = new ActiveXObject("ADODB"+String.fromCharCode(0x2e)+"Stream"); sGet.Mode = 3; sGet.Type = 1; sGet.Open(); sGet.Write(xPost.responseBody); sGet.SaveToFile(iLocal,2); |
活跃的HOSTS项目
FQ: https://github.com/sy618/hosts
- PLAY: https://raw.githubusercontent.com/sy618/hosts/master/p
- Youtube: https://raw.githubusercontent.com/sy618/hosts/master/y
FQ: https://github.com/racaljk/hosts fq数据引用了github上最热门与优秀的google hosts项目
AD: https://github.com/vokins/yhosts 慎用
FQ: https://github.com/lennylxx/ipv6-hosts ipv6
FQ: https://github.com/wangchunming/2017hosts 有ipv4/6,手机版和电脑版都是不一样的域名方案
FQ+AD: https://raw.githubusercontent.com/sy618/hosts/master/ADFQ vokins/yhosts/master/hosts + sy618/hosts/master/FQ 数据合并
各平台HOSTS文件位置
hosts文件在不同操作系统中的位置如下表所示:
操作系统 | 版本 | 路径 |
---|---|---|
Unix、类Unix系统(例如Linux等) | /etc/hosts |
|
Microsoft Windows | 3.1 | %WinDir%\HOSTS |
95、98、ME | %WinDir%\hosts |
|
NT、2000、XP、2003、Vista、2008、 7、2012、8、8.1、10 |
%SystemRoot%\System32\drivers\etc\hosts |
|
Windows Mobile、Windows Phone | 注册表项HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts |
|
Apple Macintosh | 9或更早版本 | Preferences 或System 目录中 |
Mac OS X 10.0–10.1.5 | 通过NetInfo 或niload 设置 |
|
Mac OS X 10.2和更新版本 | /etc/hosts (指向/private/etc/hosts 的符号链接) |
|
Novell NetWare | SYS:etc\hosts |
|
OS/2和eComStation | "bootdrive":\mptn\etc\ |
|
Symbian | Symbian OS 6.1–9.0 | C:\system\data\hosts |
Symbian OS 9.1+ | C:\private\10000882\hosts |
|
MorphOS | NetStack | ENVARC:sys/net/hosts |
AmigaOS | 4 | DEVS:Internet/hosts |
AROS | ENVARC:AROSTCP/db/hosts |
|
Android | /etc/hosts (指向/system/etc/hosts 的符号链接) |
|
iOS | iOS 2.0和更新版本 | /etc/hosts (指向/private/etc/hosts 的符号链接) |
TOPS-20 | <SYSTEM>HOSTS.TXT |
|
Plan 9 | /lib/ndb/hosts |
|
BeOS | /boot/beos/etc/hosts |
|
Haiku | /boot/common/settings/network/hosts |
|
OpenVMS | UCX | UCX$HOST |
TCPware | TCPIP$HOST |
|
RISC OS | 3.7, 5 | !Boot.Resources.!Internet.files.Hosts |
later boot sequence | !Boot.Choices.Hardware.Disabled.Internet.Files.Hosts (RISC OS 6.14) |
跨平台自动更新HOSTS工具
HostsTools https://github.com/HostsTools/ https://github.com/racaljk/hosts/tree/master/tools