Win7系统hosts文件怎么修改?

由于工作的关系,或者安装一些软件,需要修改hosts文件,hosts文件的作用是将一些常用的网址域名与其对应的IP地址建立一个关联 。不过很多用户并不知道如何修改hosts文件,本文就给大家详细介绍Win7系统修改hosts文件的方法,在介绍修改之前,先告诉大家如何查找hosts文件 。
查找hosts文件
1、首先,打开桌面的“我的电脑”,或者是通过开始菜单进入到我的电脑;

Win7系统hosts文件怎么修改?

文章插图
2、之后,进入到“C:WindowsSystem32driversetc”目录下,这个时候会看到目录下有一个“hosts”文件,这个就是所谓的hosts文件;
Win7系统hosts文件怎么修改?

文章插图
3、在xp以及03系统下hosts文件的路径有点不同,这两个系统需要进入到“C:WindowsSystem32driversetc”目录下,即可找到对应的hosts文件 。(默认位置为%SystemRoot%system32driversetc)
Win7系统hosts文件怎么修改?

文章插图
修改hosts文件
1、进入到该目录下之后,双击打开该文件 。如下图,弹出“打开方式”窗口,选择以“记事本”打开 。
Win7系统hosts文件怎么修改?

文章插图
2、以文本的方式打开hosts文件之后,原始的hosts文件内容如下:
# Copyright (c) 1993-2009 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 handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost


Win7系统hosts文件怎么修改?

文章插图
3、同时,也可以通过下图的方式进行修改hosts文件(域名ip地址的方式) 。
Win7系统hosts文件怎么修改?

文章插图
4、之后,进行保存,一般情况下是不能进行直接保存的:选择保存的位置,然后以没有后缀名的方式保存 。
Win7系统hosts文件怎么修改?

文章插图
5、保存完成之后,拷贝对应保存好的hosts文件,拷贝到“C:WindowsSystem32driversetc”目录下(默认位置为%SystemRoot%system32driversetc) 。
Win7系统hosts文件怎么修改?

文章插图
6、在点击替换的时候,有时候会提示权限的问题,点击“继续”进行替换 。
Win7系统hosts文件怎么修改?

文章插图
7、这样我们就完成了hosts文件修改的操作 。
hosts文件在不同系统中所处的目录:
Windows Vista/7/8/8.1: %windir%system32driversetc
Windows XP/Millennium:%windir%
Windows 95/98/Me:%WinDir%
Linux及其他类Unix操作系统:/etc
Win7系统hosts文件怎么修改?

文章插图
8、在修改完成hosts文件之后,以(域名 ip地址的方式)修改完成之后,打开运行界面(Win R打开),输入“cmd”进行测试 。(该域名为有效域名,测试才有效,否则该测试则不起作用)

推荐阅读