我在 Windows 8.1 中丢失了我的hosts
文件。我在 中找不到它C:\Windows\System32\drivers\etc
。
这是我在该位置看到的内容:hosts.ics
,,,,和。hosts.old
lmhosts.sam
networks
protocol
services
我该如何修复它?
答案1
默认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
(以 开始的行#
是文件中的注释hosts
。)
如果该文件不存在,则会在启动时在 Windows 事件日志中记录一个事件,但不会停止任何工作。
hosts
您可以简单地创建一个名为(参见)的新空文本文件在 Windows 8 上编辑 hosts 文件),如果您想添加自己的自定义条目,只需将它们添加到其中(如默认文件中的示例注释所示hosts
,但没有#
行首的)。
答案2
您有一个hosts.ics
文件,如果这样的文件存在,则会使用它来代替传统hosts
文件。
您可以通过添加新条目来验证这hosts.ics
一点
127.0.0.1 my.test.local
进而ping my.test.local