Previously we published a tutorial on how to edit HOSTS file in Windows 7 using Notepad. This time, we will show you a nice and simple trick, so that you can edit HOSTS file in Windows 7 right from the right click context menu. At the end of the tutorial, you will get something like this:
What is HOSTS file?
The hosts file is one of several system facilities to assist in addressing network nodes in a computer network. It is a common part in a operating system’s Internet Protocol (IP) implementation, and serves the function of translating human-friendly hostnames into numeric protocol addresses, called IP addresses, that identify and locate a host in an IP network.
In some operating systems, the host file content is used preferentially over other methods, such as the Domain Name System (DNS), but many systems implement name service switches (.e.g., nsswitch.conf) to provide customization. Unlike the DNS, the hosts file is under the direct control of the local computer’s administrator.
Reference: Cisco Networking Academy Program: First-Year Companion Guide”, page 676 (2nd Edition). Cisco Systems, Inc., 2002, ISBN 1-58713-025-4.
Which Operating Systems supports blocking of HOSTS file?
How to add the option edit HOSTS file in Windows 7 from right click context menu?
There are two ways: via vbs file (not recommended by us) or adding a registry value. We will show the second way.
Open Notepad and write this code:
Windows Registry Editor Version 5.00
@=”Edit HOSTS file”
Now, save the file from Notepad’s File > Save menu with any name you like, say Add HOSTS file option.reg and do not forget to change the file type to All files from Text documents from drop down menu as we already said in other tutorials.
Just double click the file and accept all the security prompts to get the option.
How to remove this option or revert to default?
Very easy. Just create a registry file with notepad again, just add a minus sign before the HKEY starts; i.e. [-HKEY_CLASS... keep others as before. Save the file like above and run it and you will get rid of the option.
Here are both registry files for your convenience, just click to download and use them.
This are potentially dangerous tweaks to play with for new users. Do not download from places like forums where unknown users or members posts with malicious codes embedded within it.