hosts文件被删除了如何解决

hosts文件被删除了如何解决
最新推荐文章于 2025-06-16 16:28:19 发布
原创
最新推荐文章于 2025-06-16 16:28:19 发布
·
1.9w 阅读
·
6
·
21
·
CC 4.0 BY-SA版权
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
大数据
专栏收录该内容
41 篇文章
订阅专栏
本文介绍如何给Windows系统中的etc目录授权及恢复hosts文件的方法。首先需要进入特定路径并给etc目录进行权限设置;接着创建新的hosts.txt文件,并通过重命名方式去掉后缀,最终将其转换为有效的hosts文件。
一、给etc目录授权
进入c:\windows\system32\drivers\etc
选中etc目录,右键-属性-高级
二、恢复hosts文件
进入目录C:\Windows\System32\drivers\etc
新建hosts.txt,将下面内容复制到hosts.txt中
# 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
然后通过重命名的方式去掉后缀,变为hosts