Search
Close this search box.

Beware of spacing in Windows7 hosts file

The hosts file of Windows, by default located in %SystemRoot%\System32\drivers\etc, can be a bitch to edit, so it seems.

I had an XP machine running just fine with the entries from my hosts file. I then made a Windows7 partition on the same machine, with the same entries in the hosts file. Didn’t work at all. It seemed as if the hosts file was completely ignored. So I did some searches on that and tried a lot of stuff. Even up to checking out the registry entry for the path, and the system variables, if they were set to correct values.

However, nothing seemed to work. Until I saw some other example hosts files that were formatted as <ip address><single space><value>

Notice the single space. In my own hosts file, all entries were nicely outlined by use of multiple spaces, to make it easier to read. So it seems now that in Windows7, unneeded whitespace is not thrown away anymore. Threw away the “markup whitespace” and everything worked in an instance.

I don’t have any clue on how many people use the hosts file intensively, but it might not be such a bad thing for the folks in Redmond to have a look at that.

Word to the wise: beware of spacing 🙂

This article is part of the GWB Archives. Original Author: Jan Schepens

Related Posts