For experienced users
Even as an Administrator it can sometimes be tricky to edit the Hosts file in Vista, or in any Windows 7 system that has been upgraded from Vista. Generally the workaround is to open Notepad by right clicking, selecting run as administrator, and then navigating to Windows/System32/ Drivers/ etc/ hosts - editing, and remembering to save as all files, not text (just click on existing Hosts file to replace.) The hosts file ought never to have a file type extension like .txt.
However, many Vista installs - and Windows 7 upgrades from Vista - will present an Administrator with a read only hosts file. Assign yourself full control and you'll still be unable to save amendments. This issue can be overcome by undoing the read only restriction using the command line editor.
C:\Users\Administrator>cd C:\Windows\system32\drivers\etc
C:\Windows\System32\drivers\etc> attrib -s -r -h hosts
NB "Administrator" in first line is your user name.
This will give you full control, and once you have edited you can always return the file to read only for security, just type:
C:\Windows\System32\drivers\etc>attrib +s +r +h hosts
[In case you're wondering, the Hosts file can be used to record regularly used (desirable) IPs to speed connectivity,
and to start a block list of advertising (such as Google) or undesirable content - in the latter case, simply specify your computer's home address : 127.0.0.1 and the domain name e.g. pagead.googlesyndication.com. In your Hosts file the new entry would look like this:
127.0.0.1 pagead.googlesyndication.com this to stop your browser looking for ads from pagead.googlesyndication.com
208.75.208.172 myfavouritesite.com this to speed up your browser by doing away with the need for a DNS query via, say, your ISP]
Should you wish to view, or to use a comprehensive list of ad/spy/trojan domains in your Hosts file, you could try someonewhocares.org/hosts