如何在 Windows 10 中將 Hosts 文件重置回默認值

Jacki

每個 Windows 版本都附帶一個 Hosts 文件,它提供了一種將網站重定向到 IP 地址的簡單機制。如果 HOSTS 文件被錯誤或惡意修改,則可能會破壞您的互聯網。在本教程中,我們將向您展示如何輕鬆地將 HOSTS 文件 (C:\Windows\System32\drivers\etc\hosts) 重置回 Windows 10 中的默認值。

如何在 Windows 10 中將 Hosts 文件重置回默認值?

默認情況下,HOSTS 文件受操作系統保護,因此如果沒有管理員權限,您將無法編輯它。這裡我們用記事本打開HOSTS文件,並將其內容恢復為默認值:

單擊開始按鈕和類型記事本。右鍵單擊搜索結果中出現的記事本應用程序,然後選擇“以管理員身份運行”。

更多閱讀:如何修復 Windows 中的“讀取本地主機文件時出錯”

在管理員模式下打開記事本後,您就可以打開 HOSTS 文件了。單擊文件菜單並選擇打開

瀏覽到目錄 C:\Windows\System32\drivers\etc\hosts。將文件過濾器下拉框從“文本文檔 (*.txt)”更改為“所有文件“,然後選擇 HOSTS 文件並單擊打開

現在,將以下文本粘貼到記事本中:

# Copyright (c) 1993-2006 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 handle within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

單擊文件菜單和節省。現在您已成功將Windows 10中的HOSTS文件重置回默認值。對於Windows 8/7/Vista,HOSTS文件的內容有所不同,您可以從以下位置複製它們微軟的網站