Looks like you are in windows 7. Open notepad as administrator and open host file using file menu from notepad. Make changes and save it.
Alternatively, while you have the list of the files in explorer, you can start notepad (windows start, run, type "notepad" and enter; then drag the hosts file into the open notepad, and walla - it will display the contents of the hosts file
Note that when saving the file back, do not save it as a text file, i.e. hosts.txt, as hosts does not have an extension name to it.
You can press "Ctrl + S" to save the changes you made.
Right click on it and go to Properties.
See whether Read only check box is checked or not.
If ticked,then un tick it.
It's a feature for both windows vista and windows 7.
When you do any that affect system stuffs will prompt you to confirm the action.
You may alternate turn it off from user control panel.
1. Locate Notepad in Start > Accessories > Notepad
2. Right click Notepad and select "Run as Administrator"
3. Once opened you can do File > Open and locate the host file OR drag and drop the host file into Notepad.
4. When saving make sure to remove the ".txt" extension.
The reason you need to do this is that the host files are considered system files that are protected and only Administrative access will grant you write access to the files. There is a difference between you having an Administrator account and you running as Administrator. You are technically given the privileges but it doesn't mean you're always running everything as Administrator (otherwise that is really dangerous to your file system).
Do NOT attempt to circumvent it in any other way. Though you can, you shouldn't as this defeats the whole purpose of the security in the design.
The award for first piece of sensible advice in this thread goes to eclipious! As for everyone else...
@metalfreek: Correct but doesn't provide details on how to run Notepad as administrator (why does Windows have no sudo command?).
@menino: That doesn't work, you need to run Notepad as administrator, while your method runs it as a regular user.
@cybersa: If that works, it's like destroying a safe to get at the contents when you know the code - it kinda dissolves whatever security having it read only provides. However, this is a permissions issue not a file attributes issue so unless Windows assigns weird meaning to "read only" (which is entirely possible), what you suggest simply won't work.
@blueray: Wrong wrong wrong. UAC isn't appearing, that's the whole problem. Ideally, Notepad should prompt the user for administrator credentials when attempting to save a file which the user doesn't have permission for.
Thx everyone. I forgot to let you know that you helped me
Click to start? then right click on CMD icons and select "Run as administrator" in commandline input
notepad and press enter. You opened notepad.exe in admin mode , so next step open hosts and edit...