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.

link|improve this question
feedback

2 Answers

up vote 8 down vote accepted

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

link|improve this answer
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 '11 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 '11 at 20:03
You can test buy adding an entry and then pinging it. As a test add this line: 102.54.94.97 rhino.acme.com If it works, then delete it. You don't have to do anything else to make it work. It is automatic with the entry. After that, I would also greatly appreciate it if you would click the checkmark next to my answer if that did answer the question. People are more willing to answer if you have a good acceptance rate. Thank you. – KCotreau Jul 6 '11 at 20:08
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 '11 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 '11 at 20:15
show 4 more comments
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.