Locked hosts file on Windows 7

As a web application developer, you need to make changes to the Windows hosts file from time to time, to resolve IP addresses. This is something I’d done frequently with Windows XP but never tried it on Windows 7 before. And like the stubborn mule that Windows 7 is, it obsolutely refused to let me write to the hosts file.

None of the following worked:

  • Run notepad as Administrator.
  • Set UAC to minimum (not recommended by the way).
  • Change hosts file security so I have read/write/full control.
  • Take ownership of the hosts file.
  • Turn off router, and stop my firewall and anti-virus.
  • Reboot numerous times

Then I eventually found the solution: Restart in safe mode¬†without network (hold down F8 during BIOS initialisation screen), open notepad as Administrator, and finally Windows 7 let me save my changes. I can’t believe something so trivial was that difficult. Security overkill perhaps?

Advertisements

About Phil Munro

I have been developing commercial desktop and distributed web applications with Microsoft technologies since 1997.
This entry was posted in Windows 7. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s