Windows7 will not let me edit the hosts file and save it

Anonymous
2010-04-16T18:31:57+00:00

Windows7 will not let me edit the hosts file and save it. What must I do in order to save the edited host file?

Windows for home | Previous Windows versions | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Anonymous
2010-04-16T18:47:57+00:00

It's a built-in safety feature.  There is an easy workaround.  ClickStart ->All Programs -> Accessories.  Right-clickNotepad, and then click Run as administrator.  If you are prompted for an administrator password or for a confirmation, type the password, or clickAllow or Yes.

Open the Hosts file (from the notepad you just opened) , make your changes, and then click File ->Save

Barbara

Was this answer helpful?

200+ people found this answer helpful.
0 comments No comments
Answer accepted by question author
Anonymous
2010-04-16T20:43:01+00:00

You need to either take ownership of the file (Right click the hosts file, Security tab, and give yourself full rights), or open Notepad as Administrator and open, edit and save your hosts file from there. It's designed that way so some rogue malware can't come in and change that.

Was this answer helpful?

70+ people found this answer helpful.
0 comments No comments

66 additional answers

Sort by: Most helpful
  1. Anonymous
    2011-07-21T22:15:02+00:00

    I had to disable Mcafee On Access Protection before I was allowed to save the hosts file without it being a hosts.txt

    Was this answer helpful?

    5 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2012-04-16T13:04:47+00:00

    Open hosts with notepad.exe, edit, save as hosts.txt

    Restart computer in [safe mode with command prompt]     -using the gui will cause failure-

    Login as an Administrator

    cd \

    cd \windows\system32\drivers\etc\

    del hosts

    ren hosts.txt hosts

    shutdown /r

    This did work. result: success

    There should be a simpler way...

    I tried taking ownership of the file with       takeown

    Tried opening up notepad as administrator

    added myself to the file security as an administrator

    added myself to the folder security as an administrator

    none of these actions made any difference, result failure

    I read about others being able to simply use these methods and succeed, but they did

    not work for me.

    The only suggestion I have not tried yet was the "turn off USER ACCOUNT CONTROL SETTINGS.

    Was this answer helpful?

    3 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2011-07-21T16:14:37+00:00

    I reinstalled Windows 7 as of July 2011 with sp1 and  installed also all the updates.

    I tried everything to update hosts:

    Run notepad as an admin

    Run cmd.exe as an admin and run notepad.exe hosts from the cmd commande

    try to rename or remove hosts from cmd command to change it

    Tried to change the security rights in every way; security rights of the file itself, of the directories also to no avail

    I had no problem before this new installation, last time I updated it was nearly a month ago, but I'm unable to update hosts with the new one. My new installation is from the same disk than the previous one. The only differences are the updates maybe.

    back to Notepad the only thing I'm allowed to do is to save it as hosts.txt then impossible to copy or rename or else

    Was this answer helpful?

    3 people found this answer helpful.
    0 comments No comments