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: Newest
  1. Anonymous
    2012-10-25T00:28:11+00:00

    I tried this and it when I right clicked on the notes file in the system32/drivers/etc/hosts. A window came up after I added the change to the file in notepad. The error message still told me that I didn't have permission to make changes and asked if I wanted to add the change to a file in My Documents instead. I have tried every which way. I even used CMD to add myself as administrator and remove the security but that still didn't work. I don't know what else to do. There must be something simple that I am missing 

    Do the follwing:

    Open notepad as administrator.

    Inorder to do that, click on Start > type notepad > right click on notepad when the notepad option appears and select run as administrator. If UAC is prompted, click YES.

    Then, in the notepad click on File > Open > and navigate it to the host file in system32, drivers.

    When you have the host file open with administrator notepad file, you will be able to edit and save it.

    (This applies for Windows Vista and 7. If you are using XP, please try from safe mode and it should work fine.)

    Should you have any questions, please feel free to ask.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-10-22T17:28:30+00:00

    In my case, my antivirus program (Webroot) was preventing me from changing the file.  You might want to check if you have something like that going on.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2012-10-22T17:22:22+00:00

    I tried this and it when I right clicked on the notes file in the system32/drivers/etc/hosts. A window came up after I added the change to the file in notepad. The error message still told me that I didn't have permission to make changes and asked if I wanted to add the change to a file in My Documents instead. I have tried every which way. I even used CMD to add myself as administrator and remove the security but that still didn't work. I don't know what else to do. There must be something simple that I am missing 

    Have you tried unchecking the read-only checkbox in the notes file properties?  I had the same issue and that is what worked for me.

    Was this answer helpful?

    0 comments No comments