Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Win7 hosts 檔案無法修改/儲存?完整修復與權限設定教學

編輯:Win7 系統應用技巧

想編輯 C:\Windows\System32\drivers\etc\hosts 卻提示「權限不足」或存檔失敗,因為 hosts 為系統保護檔案,需管理員權限且需移除唯讀屬性才能修改。

hosts 檔案位置與作用

  • 路徑:C:\Windows\System32\drivers\etc\hosts
  • 功能:本機域名解析對照表,優先順序高於 DNS,常用於封鎖廣告、測試網站、加速特定域名存取。

修復與編輯步驟

  1. 先以系統管理員身分執行記事本:
    開始 → 搜尋「記事本」 → 右鍵 → 「以系統管理員身分執行」。
  2. 記事本「檔案」→「開啟」→ 路徑貼上 C:\Windows\System32\drivers\etc → 右下角「文字文件」改「所有檔案」 → 選 hosts 開啟。
  3. 清空原內容,貼入標準預設內容:
    # Copyright (c) 1993-2009 Microsoft Corp.\n#\n# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.\n#\n# localhost name resolution is handled within DNS itself.\n#\t127.0.0.1\tlocalhost\n#\t::1\t\tlocalhost
  4. 「檔案」→「儲存」(管理員權限下可直接覆寫)。
  5. 若仍失敗,檢查檔案屬性 → 取消勾選「唯讀」 → 套用 → 再試一次儲存。

提醒:修改 hosts 後建議執行 ipconfig /flushdns 清除 DNS 快取,讓變更即時生效。若遭惡意程式竄改,請先全盤掃毒再修復。

Copyright © Windows教程網 All Rights Reserved