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.
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.
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.
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.
- Open windows explorer, and navigate to C:\Windows\System32, find the notepad.exe file in the file list.
- Right click the notepad.exe file, click Run as administrator menu item in the popup menu list.
- Open the hosts file in the notepad tool and edit ip domain mappings like below. Now you can save the file successfully.