4 Answers
4

An empty file at %windir%\system32\drivers\etc\hosts will mean an empty hosts file. If you look at the default file, all the lines are commented out (lines start with #). If you really want to clear your hosts file, either fire it up in Notepad and clear everything that doesn't start with a # or run this from an elevated Command Prompt:

echo. 2> %windir%\system32\drivers\etc\hosts

If you want to clean out specific entries you can use Notepad or findstr /V to strip the entries and rewrite to the file.

If you have hard-coded the IP address of the website in your hosts file, then you may need to hand-edit the file (usually called) C:\Windows\System32\drivers\etc\hosts. Find the entry in that file related to the website, and insert a hash/pound/number sign (#) at the beginning of that line.

ipconfig is the wrong way to go at this. This only clears the resolver's cache.

The host file is a text file located, I think, in %windir%\system\drivers\etc.

You'll have to fire up an elevated Notepad to edit the entries, if somehow they were changed without your knowledge.

To start up notepad elevated, hit the Window key and type notepad. Then press CTRL+ Shift+ ENTER. A UAC prompt will appear. Navigate to the host file and open it up. If it contains a lot of weird entries, you could be infected with malware.

I'd backup your data and clear the disk. There is no telling what else may be spying on your data. Then find yourself a good antivirus( I recommend Microsoft's Security Essentials) and use Chrome for browsing insecure sites.

That will force it to refresh the computers DNS cache.
If your PC is connected to a router and using the router as a DNS resolver, you may need to power off that device for 5 minutes as well as the modem connected to it to allow it to fully reset and power them back up.

Based on the original context of the question (which has now been changed) he said that he was having issues connecting to websites. Which as most of us would understand is not related to his hosts file. And yes I do understand that DNSchace != host file. It just seemed unlikely that a user would have multiple websites hardcoded into their hosts file for public webpages.
–
JKMAug 10 '11 at 13:52