Win10找不到hosts文件的解决方案“隐藏的项目”也找不到
MarkDown
正常情况下,Windows10系统的C:\Windows\System32\drivers\etc目录下应该有hosts文件,但偏偏有些电脑没有,哪怕你打开了查看“隐藏的项目”也没见到hosts文件。
“Window + R”打开cmd,输入以下命令:
for /f %P in ('dir %windir%\WinSxS\hosts /b /s') do copy %P %windir%\System32\drivers\etc & echo %P & Notepad %P
若自动打出hosts文件并且命令行出现“已复制 1 个文件。”说明hosts文件成功存在于C:\Windows\System32\drivers\etc
其实原Win10系统的HOST文件只能说是一个空文件而以 因为 # 在HOST中是注释掉的意思,所以都是没用的一些信息,保持空白也是可以的。
# 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 inpidual 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 inpidual
# 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
