How can I overwrite the hosts file in Windows 7?

Solution 1:

If you're logged in as an administrative user, that's not enough. You will need to right click on the Notepad icon and select Run as administrator.

Solution 2:

You can right-click on the hosts file and click Propeties, then Security. Add your username to the security group and give yourself read/write permissions. Click Apply and you will be able to save your new settings.

But when you finish I advise you to remove yourself from the security group to prevent any unwanted changes done by others.