Windows 7: How to edit hosts file

To edit the hosts file on a Windows 7 system just follow the instructions below:

  1. Press Windows-Key or click on Windows icon
  2. Search for “cmd.exe
  3. Press Strg+Shift+Return or right click on cmd.exe and select “Run as administrator”
  4. Confirm the Windows UAC dialog.
  5. Run
    notepad %systemroot%\system32\drivers\etc\hosts
  6. Edit the hosts file and save the changes
  7. Close the notepad editor and the command line prompt

Comments

  1. th3p00r

    Hi,

    Sorry, I tried your method but it did not work. I’m been searching for answer on google; unfortunately, I haven’t found one, yet. I even logged on the system as Administrator. Please advise.

    Thank you,

  2. nil

    Step 1. Open your Windows start menu, search for the notepad application and then right click the notepad icon.

    Step 2. Choose “Run as administrator” and then, while inside notepad, ( from file -> open ) browse to folder (/windows/system32/drivers/etc) that contains the hosts file.

    now edit and save ! when you want to save don’t forget to brows All File Types so find hosts click on Hosts File and when it asked you to save on excited file, click yes.

  3. SuperEliteGames

    It saves as a .txt file, so it doesn’t work.
    Maybe I’m doing something wrong….

  4. Jan Jonas

    When saving the file with the “save as” dialog, you have to select “All files (*.*)” as file type. As an alternative you can surround the file name with double quotes.

  5. stylinred

    Hi ive had to do this everytime i reinstall windows but i keep forgetting how to correctly edit my hosts file

    -_- this method doesnt work for me it seems windows ends up ignoring the hosts file entirely after i changed it

    open as admin edit as admin saves as a host file (not a txt file) registry is pointing to the hosts file correctly

    but when i ping the entry it doesnt change; any clues?

  6. Jan Jonas

    Hi stylinred,
    how does your hosts file exactly look like?

Leave a comment

Your email address will not be published. Required fields are marked *

*