How To Edit Hosts File In Windows 10

In windows, hosts file is used to resolve domain and ip address mapping, so when you use a domain name in web browser or other client tool, windows will first find the domain’s related ip address in the hosts file, if find then use that ip to communicate with the server, if not find 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 same, but for windows 10, the edit method is not 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.

When a windows user edit a text file, the normal process is right click the text file and click open with menu item to open the text file with notepad, after edit the content then click save menu item to save it.

But in windows 10, when you want to save the hosts file after edit, it will prompt below dialog that said you do not have permission to save this file, need administrator permission.

do not has permission error when save window 10 hosts file

After investigate, 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.

windows 10 etc folder permission is read only

But when i uncheck the Read-only checkbox and click OK button, it prompt below error dialog also, the prompt dialog said access denied, i need administrator permission to change the read only attribute.

windows 10 change etc folder read only attribute access denied

2. How To Edit Win 10 hosts File Successfully.

After investigate on the internet, i finally find the method to change the hosts file content in windows 10 follow below steps.

  1. Open windows explorer, and navigate to C:\Windows\System32, find the notepad.exe file in the file list.
    c windows system32 notepad exe
  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.
    127.0.0.1 test.com
READ :   How To Install Virtualbox Extension Pack Correctly

Leave a Reply

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.