hosts 檔案位於 C:\Windows\System32\drivers\etc\hosts (無副檔名)。找不到通常是「隱藏屬性」、「系統保護檔案隱藏」或「系統精簡版被移除」。
C:\Windows\System32\drivers\etc。hosts。etc) 按 Ctrl+F 或點右上角搜尋框。hosts,搜尋範圍選「目前資料夾」。etc 資料夾空白處右鍵 → 「新增」→ 「文字文件」。hosts.txt 重新命名移除 .txt)。# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost
# 自訂封鎖/映射
0.0.0.0 ad.example.com
192.168.1.100 myserver.local技巧: etc 資料夾通常有 lmhosts.sam (範本檔),用記事本開啟 → 「另存新檔」為 hosts,再修改內容,最快取得正確格式。
C:\Windows\System32\drivers\etc → 檔案類型改「所有檔案」→ 選 hosts。notepad C:\Windows\System32\drivers\etc\hosts 在管理員 CMD/PowerShell 中執行。三種方法總有一款適合你,搞定 hosts 檔案,掌握本地域名解析主動權。