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?
Mac OS X, UNIX, UNIX like (Linux), Microsoft Windows, Symbian, iOS, Android etc.
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
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@=”Edit HOSTS file”
“HasLUAShield”=””[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@=hex(2):6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,00,20,\
00,25,00,77,00,69,00,6e,00,64,00,69,00,72,00,25,00,5c,00,73,00,79,00,73,00,\
74,00,65,00,6d,00,33,00,32,00,5c,00,64,00,72,00,69,00,76,00,65,00,72,00,73,\
00,5c,00,65,00,74,00,63,00,5c,00,68,00,6f,00,73,00,74,00,73,00,00,00
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.
Caution:
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.
