How to – Edit “hosts” File in Windows

Today I realized that this issue is unknown to some people. So, here I am sharing the info.

Brief Info On Hosts File

Hosts file is one of the facilities in Windows that makes addressing nodes in a network easier. This file is used by the operating system to map host names to IP addresses.

An entry in the hosts file such as “192.168.67.86 myserver.myapp” maps “myserver.myapp” to the IP “192.168.67.86” so that when you type myserver.myapp in your browser request goes to 192.168.67.86 reaching your application serving on that IP.

Editing the File

Win 7:

1-Click on Start

2-Right-click on Notepad and click “Run as administrator”

screen1

Win 8:

1-Click Windows button (the button with the windows icon on it) to switch to the Metro UI

2-Start typing “notepad” and when the program icon is displayed right-click on it and click “Run as administrator”.

win8-notepad-run-as-admin

3-Click “Yes” on the confirmation screen

Notepad opens with Administrative privileges.

Now click “File” and Click “Open”

Copy and paste %SystemRoot%system32driversetc to the address bar of the window and hit enter. This resolves to C:WindowsSystem32driversetc directory on your computer (works for win 7 and Win8, not sure about XP and expecting it to work for future releases of Windows).

Select “All Files” on the bottom-right of the window

screen2

Select “hosts” file and click “Open”

Now you can edit hosts file and save the changes.

Hope this helps someone.

Good luck,
Serdar

Leave a Reply

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