摘要

本文可協助您將 Hosts 檔案重設回預設值。

何謂 Hosts 檔案?

作業系統會使用主機檔案來將容易理解的主機名稱與數字網際網路通訊協定 (IP) 位址對應,以識別並尋找 IP 網路中的主機。 主機檔案是數個系統資源的其中一個資源,負責處理電腦網路中的網路節點,是作業系統 IP 實作中常見的元素。

Hosts 檔案的第一個文字欄位包含數行由 IP 位址組成的文字,後面接著一個或多個主機名稱。 每個欄位都會以空白字元 (通常使用定位點做為記錄之用,但也會使用空格) 分隔。 可能會包含註解行,並且這些行的第一個位置會以井字號 (#) 表示。 檔案中完全空白的行則會遭到忽略。

如果變更主機檔案的預設值,將其重設可解決某些連線問題。

解決方案

如果要將 Hosts 檔案重設回預設值,請根據您的作業系統執行下列步驟:

如果要將 Hosts 檔案重設回預設值,請依照下列步驟執行:

  1. 開啟 [記事本]。 若要執行這項操作,請使用 Cortana搜尋「記事本」,然後點選或按一下 「記事本」圖示。

  2. 複製下列文字,然後將文字貼至檔案: # 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

  3. 「檔案」 功能表中,選取 「另存新檔」,在 「檔案名稱」 方塊內輸入「hosts」(如下圖所示),然後將檔案儲存到桌面。 Screenshot showing how to save the "hosts" file

  1. 關閉 [記事本]。

  2. 搜尋 %WinDir%\System32\Drivers\Etc 使用 Cortana,然後選取 「檔案」資料夾 圖示。

  3. 對 Hosts 檔案選取不放或按右鍵,選取 「重新命名」,然後重新命名為「Hosts.old」。

  4. 將您在步驟 3 建立的 Hosts 檔案複製或移至 %WinDir%\System32\Drivers\Etc 資料夾。 如果提示您輸入系統管理員密碼,請選取 「繼續」

如果要將 Hosts 檔案重設回預設值,請依照下列步驟執行:

  1. 開啟 [記事本]。 若要執行這項操作,請從螢幕右側向內撥動,點選 [搜尋],輸入「記事本」,然後點選 [記事本] 圖示。 或者,如果您使用滑鼠,請指向螢幕右上角並將滑鼠游標往下移,然後按一下 [搜尋],輸入「記事本」,然後按一下 [記事本] 圖示。

  2. 複製下列文字,然後將文字貼至檔案: # 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

  3. [檔案] 功能表中,選取 [另存新檔],在 [檔案名稱] 方塊內輸入「hosts」(如下圖所示),然後將檔案儲存到桌面。
     On the File menu, select Save as, type "hosts" in the File name box (as displayed in the following image), and then save the file to the desktop.

  4. 關閉 [記事本]。

  5. 開啟 %WinDir%\System32\Drivers\Etc 資料夾。 如果要執行這項操作,請依照下列步驟執行:

    1. 從螢幕右側向內撥動,點選 [搜尋],輸入「執行」,然後點選 [執行] 圖示。 或者,如果您使用滑鼠,請指向螢幕右上角並將滑鼠游標往下移,然後選取 [搜尋],輸入「run」,然後選取 [執行] 圖示。

    2. [開啟] 方塊中輸入 %WinDir%\System32\Drivers\Etc,然後選取 [確定]

  6. 選取 Hosts 檔案,選取 [重新命名],然後重新命名為「Hosts.old」。

  7. 將您在步驟 3 建立的 Hosts 檔案複製或移至 %WinDir%\System32\Drivers\Etc 資料夾。 如果收到輸入系統管理員密碼的提示,請點選或按一下 [繼續]

如果要自行將 Hosts 檔案重設回預設值,請依照下列步驟執行:

  1. 按一下 [開始],再按一下 [執行],輸入「Notepad」,然後按一下 [確定]

  2. 將下列文字複製到檔案中:

    如果是 Windows 7 # 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 Vista 或 Windows Server 2008 # 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 127.0.0.1 localhost ::1 localhost 如果是 Windows XP 或 Windows Server 2003 # 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

  3. [檔案] 功能表中,選取 [另存新檔],在 [檔案名稱] 方塊內輸入「hosts」,然後將檔案儲存到桌面。
    On the File menu, select Save as, type "hosts" in the File name box, and then save the file to the desktop.

  4. 選取 [開始] > [執行],輸入 %WinDir%\System32\Drivers\Etc,然後選取 [確定]

  5. 選取 Hosts 檔案,然後重新命名為 "Hosts.old"。

  6. 將您在步驟 3 建立的 Hosts 檔案複製或移至 %WinDir%\System32\Drivers\Etc 資料夾。 如果出現要求您輸入系統管理員密碼的提示,請選取 [繼續]

其他相關資訊

針對 Windows XP 的支援已終止

Microsoft 於 2014 年 4 月 8 日終止 Windows XP 的支援服務。 這項變更已經影響到您的軟體更新和安全性選項。 了解這對您有何影響,以及如何保持受保護的狀態。

對 Windows Server 2003 的支援已於 2015 年 7 月 14 日終止

Microsoft 已於 2015 年 7月 14 日終止對 Windows Server 2003 的支援服務。 這項變更已經影響到您的軟體更新和安全性選項。 了解這對您有何影響,以及如何保持受保護的狀態。

需要更多協助?

擴展您的技能
探索訓練
優先取得新功能
加入 Microsoft 測試人員

這項資訊有幫助嗎?

您對翻譯品質的滿意度為何?
會影響您使用體驗的因素為何?

感謝您的意見反應!

×