1、方法1:我们进入C:\Windows\System32\drivers\etc文件夹,然后新建一个记事本。
2、然后我们在记事本内输入以下内容:# 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#127.0.0.1 gilisoft.com然后保存。
3、我们保存后,将记事本 新建 文本文档.txt名字改为hosts,记住不要带后辍格式就叫hosts,然后系统会提示你是否确认更改格式,我们点击是就可以了。
4、方法2:我们按下WIN+R呼出运行菜单,然后在运行菜单中输入:attrib %SystemRoot%\system32\drivers\etc\hosts -h -r -s
5、然后我们继续在运行菜单中输入:notepad %SystemRoot%\system32\drivers\etc\hosts 这样就可以打开hosts文件了。