2

I have Windows 7 Pro 64 bit and it won't read the hosts file ! I've googled around for quite a long time but I can't fix it, maybe someone here can help me.

I can't see the .txt extension on the hosts file, but still windows opens it right away with notepad (so i don't know if it got corrupted somehow and it DOES have a .txt extension but I can't change it cause I can't see it).

If I go to cmdand type rename hosts.txt hosts it gives an error and says that

System couldn't find the file

If I try go to regedit and find

HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath=

I hit a wall because DataBasePath= IS NOT listed under parameters, it's like there's no entry. I don't know if my PC got infected with malware or something and it's hiding the hosts file from the registry and the system.

2 Answers 2

9

It does NOT have any extension. It is a read-only file located here:

C:\Windows\System32\drivers\etc\hosts (name of file, no extension).

You can create an empty HOSTS file if you need to. There is only information, no real data in it by default.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters

DataBasePath should have a value of: %SystemRoot%\System32\drivers\etc

8
  • ok the value of databasepath is correct, and I DO have a file called hosts in C:\Windows\System32\drivers\etc\ but it is already recognized as a notepad file even if the filename is hosts (and not hosts.txt). How do I create a new hosts file, just by creating a new notepad file and naming it hosts ?
    – Tony
    Jul 6, 2011 at 19:24
  • You are really kind, but I think I solved the issue, I just have to check haha... turns out windows wasn't showing extensions AT ALL so I couldn't delete the extension ... now the file is not recognized by any program (the icon displays as a blank paper)... Now, is there a way I can check if windows actually reads the file using cmd?... like a command or something?
    – Tony
    Jul 6, 2011 at 20:03
  • I forgot to mention the obvious: I disabled the option under the folder options that hides known file extension, that way I could see that "hosts" was indeed "hosts.txt", so I deleted the ".txt" part and got a warning that said the file could be permanently damaged, I hit ok and the system no longer recognized the file. But I still need to check if the system reads the file, and I don't want to try and load an address on my browser cause I had them blocked for a good reason ! haha... maybe I can ping in cmd?
    – Tony
    Jul 6, 2011 at 20:10
  • YES it works... (it says 100% lost)... THANK YOU so much ! haha... Now... any ideas why it happen? Was it my fault when trying to add new addresses to the file or could it be a virus?... (If I had to pick I'd say it is most likely my fault haha)... Thank you again really :D
    – Tony
    Jul 6, 2011 at 20:15
  • Yes, you open a command box, and ping rhino.acme.com after you add that line to the HOSTS file. That line is a test line from the original HOSTS file. It will not return a reply, but the IP should be what is in the file, rather than getting the error "host unknown"
    – KCotreau
    Jul 6, 2011 at 20:16
1

You can create a new hosts file and save it onto your desktop as hosts.txt. Then rename the file and remove the extension so that it's just hosts. Copy it to c:\windows\system32\drivers\etc and it will prompt you for with the UAC.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .