windows7 64位hosts文件无效解决办法

windows7 64位专业版修改host文件后根本不起作用,用了各种招数都是白扯,最后终于在老外那找到一个能真正解决问题的办法。

Windows 7 has easily been the best version of the operating system to date, by far. While Vista came with plenty of quirks, Microsoft seems to have learned from the mistakes made and corrected many of them for their release of 7. Unfortunately, nothing is perfect, and the odd quirk where Windows 7 ignores its hosts file is a good example of this. Fortunately for all of us – it’s easy to fix.

Description of problem:

Any custom entries in the Windows 7 hosts file get ignored. If, for example, you had “″ put in there (we’ll ignore just why you might have that entry in there.. :) ) and then tried to ping that address, it would still reply with its actual IP instead of as it should.

How to fix the Windows 7 hosts file:

1. First, in order to do any editing on the Win7 hosts file, you will need to open up Notepad as an administrator. To do this, Click on the Start button->Accessories, and then right-click on Notepad. A context menu will appear, then click on “Run as Administrator”

2. In Notepad, open up the hosts file located at C:\Windows\System32\drivers\etc. You’ll need to  change the filter from “Text Documents (*.txt)” to “All Files” in order to see hosts listed.

3. Select all of the contents in the file (CTRL+A), copy them (CTRL+C), open up another instance  of Notepad, and then paste the contents into the newly opened program. Close the Notepad you have the hosts file open in.

4. Now, rather counter-intuitively, you need to delete the original copy of the hosts file. Open up Windows Explorer (Start->Accessories->Windows Explorer), navigate to C:\Windows\System32\drivers\etc, and delete it. Windows will likely complain about it being a system file, etc – just ignore all that and proceed with the deletion.

5. In the Notepad you still have open, click “Save As” from the file menu, change the filter to “All Files”, type “hosts” into the file name textbox, and save it. Be sure to save it into the directory where you deleted the hosts file from originally, or else it won’t do any good.

6. TEST – This is easy enough to do. If you’re reading this then you likely already to know how to do this, but I’ll humor you anyway. Open up a command prompt and type “Ping” then press enter. Using the example above, then if you were to type “ping” then you should get four replies from

Why was the Windows 7 hosts file not working?

I have utterly no idea. I’d suspect some sort of corruption with it, but since it opens properly in Notepad without any odd artifacts showing it’s hard to tell. There’s always a possibility that there are some non-standard whitespace characters in the original copy of the hosts file that don’t get brought over when the contents are copied and pasted, but who knows. I’ve tried just cutting the contents from the file and pasting them back in, followed by saving the file but for some reason it only works when the original is deleted and a new one is saved.

原文 :

windows7 64位hosts文件无效解决办法》上有6个想法

  1. 因為 64 位元的windows 有2 個 notepad 啦,

    必須用 64 bit 的 notepad 去打開 hosts

    在桌面建一個捷徑,命名為notepad64,指向c:\windows\system32\notepad .exe即可

    用 32 bit 的notepad 去開,只會看到 c:\windows\syswow64 的東西

    雖然畫面顯示目前路徑是 c:\windows\system32,可是那是虛擬的,是系統自動切換的


    那只是在告訴系統要去執行 64 bit notepad而已

warfox进行回复 取消回复