How To Edit Hosts File In Windows 10

In windows, the hosts file is used to resolve domain and IP address mapping, so when you use a domain name in a web browser or other client tool, windows will first find the domain’s related IP address in the hosts file, if found then use that IP to communicate with the server, if not found then it will query the domain’s IP from the DNS server configured.

The hosts file is located in C:\Windows\System32\drivers\etc in windows, the file location for each windows version is the same, but for windows 10, the edit method is not the same as windows 7 or earlier. You may find you can not save the file when you edit it.

1. Edit hosts File In Windows 10 Errors.

  1. When a windows user edits a text file, the normal process is to right-click the text file and click the menu item open with in the popup menu list to open the text file with notepad, after editing the content then click the save menu item to save it.
  2. But in windows 10, when you want to save the hosts file after editing, it will prompt the below dialog that said you do not have permission to save this file, it needs administrator permission.
    You do not have permission to open this file. See the owner
    of the file or an administrator to obtain permission.
  3. After investigating, I found the C:\Windows\System32\drivers\etc folder ( that contains the hosts file ) is read-only, so I attempt to change the etc folder’s read-only attribute.
  4. I right-click the C:\Windows\System32\drivers\etc folder, then click the Properties menu item in the popup menu list, it will display the etc Properties dialog window.
  5. But when I uncheck the Read-only checkbox in the Attributes section and click the OK button, it prompts the below error message also, the prompt dialog said access denied, I need administrator permission to change the read-only attribute.
    Access Denied
        You will need to provide administrator permission to change these attributes. Click Continue to complete this operation.
                                                                                                   Continue Cancel

2. How To Edit Win 10 hosts File Successfully.

After investigating on the internet, I finally find the method to change the hosts file content in windows 10 follows below steps.

  1. Open windows explorer, and navigate to C:\Windows\System32, find the notepad.exe file in the file list.
  2. Right-click the notepad.exe file, click Run as administrator menu item in the popup menu list.
  3. Open the hosts file in the notepad tool and edit IP domain mappings like below. Now you can save the file successfully.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.