91牛牛热在线视频:WIN7下更改hosts文件

来源:百度文库 编辑:偶看新闻 时间:2024/04/29 18:59:42
WIN7下更改hosts文件的几种有效方法
Win7下因为权限问题会导致不能更改hosts文件,这让人很是苦恼.下面的几种方法很有效.希望对大家有用.
方法一、第一种方法是网上流传很广的覆盖方法.就是先复制hosts文件到别的地方,修改完了再覆盖回来就搞定了。中间会提示目标文件夹拒绝访问,需要提供管理员权限,点击继续即可。这是很简单的一种方法,这里就不多讲了.
方法二,用记事本更改
首先在开始菜单中,用管理员权限打开一个记事本,然后在记事本中打开hosts文件,这样因为是以管理员权限打开的,所以可以保存.具体步骤如下:
1、开始菜单->附件->右键点击“记事本”->以管理员运行,(操作如图)

2、打开之后,用记事本打开hosts文件,hosts文件路径的是C:\Windows\System32\drivers\etc\hosts,(操作如图)


3、点打开后,再写好自己的hosts语句,直接保存就可以了。(操作如图)

方法三,用批处理更改
1、把下面的代码写入txt文件,并另存为“hosts.bat”文件(这里注意一下,如果有些朋友的电脑是不显示文件后缀的,这样直接命名没效,要在文件夹选项中显示常用文件的后缀)。
@echo off
del %systemroot%\system32\drivers\etc\hosts
echo 127.0.0.1 www.test.com>>%systemroot%\system32\drivers\etc\hosts
start http://www.test.com
2、把里面的IP和域名更改成自己想要的,
3、右键点击”hosts.bat”文件,选择以管理员权限运行。即可。(操作如图)

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
文件地址:C:\WINDOWS\system32\drivers\etc\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
要修改这个文件的话,需要修改权限
右键单击改文件,选择[属性]
切换到[安全]选项卡,单击中间的那个[编辑]
在“组或用户名”里选择自己的那个账户(如:Users (乐乐-PC\Users))
勾选下面“完全控制”的[允许]复选框
单击[应用]后就可以修改该文件了

为了您的安全,请只打开来源可靠的网址
打开网站    取消
来自:http://hi.baidu.com/cdcdss88/blog/item/047bc6e94ce1333d2cf5342d.html