如何在xp、vista和win 7中重置hosts文件到默认状态
“Hosts”文件是windows中很重要的系统文件,这个简单的文本文件能够把网址直接定向到指定ip地址。有时你会需要修改它来屏蔽广告,但是病毒、广告软件、间谍软件和木马可能会利用它把浏览器重定向到含有恶意代码的网站,所有许多时候你需要一个默认的hosts文件来重置它。
重置之后,所有的网站指向会和新系统一模一样,不会有任何隐患。如果你在修改这个文件后出现错误,需要把它改回来,那么默认的host文件也是一个非常好的参考。
hosts文件的所在路径:
在nt、2000、xp、2003、vista和win 7的32位版本中,它存在于%windir%\System32\drivers\etc\
而64位版本则在%windir%\SysWOW64\drivers\etc\路径下。
如何把hosts文件恢复到默认状态:
- 1、你可以把引号之间的文字复制到资源管理器中,然后就可以快速找到这个文件了。
- 2、使用记事本打开这个文件。(在这之前你可以复制一下这个文件,作为备份)
- 3、清空其中的所有内容,然后把以下的内容复制进去(注意系统版本),最后保存。如果要其生效,那么之前打开的浏览器需要重启。
windows 7的默认hosts文件内容:
# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handle within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
windows vista和2008 server的默认hosts文件内容:
# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
::1 localhost
windows xp和2003 server的默认hosts文件内容:
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
或者你懒得动手的话,可以下载软件No1这篇文章底部链接中的软件,使用微软的修复工具把它恢复到默认状态。
本文地址:https://www.rjno1.com/default-hosts-file/
thank you!
不错。很详细。很有用。不过win7,winVista用户要注意权限问题。要用管理员权限。
现在微软推出了新的Fix it Center,这个应该是什么系统上都能用,fix it不清楚,应该也可以把。。。
MicrosoftFixit50267.msi
win7和XP都能用吗??