Add “Edit HOSTS file” option in the context menu
The HOSTS file, originally introduced to resolve host names to IP addresses, is also an effective tool to block Malware. To modify the HOSTS file in Windows Vista, you need to elevate Notepad.exe or any other text editor which you use. Otherwise you’ll see the following error when trying to save the HOSTS file:
Make sure that the path and the file name are correct.
(There is a Microsoft Knowledgebase article that discusses this issue. See You cannot modify the Hosts file or the Lmhosts file in Windows Vista)
Coming to the subject, here is a tip which adds the Edit HOSTS file option in the (My) Computer context menu, which when clicked, runs Notepad.exe elevated and opens the HOSTS file for you. This again uses the runas verb for elevation.
EDIT HOSTS FILE - CONTEXT MENU OPTION
1. Download EditHosts.reg and save to Desktop
2. Right-click EditHosts.reg and choose Merge
3. Click Yes when asked for confirmation.
4. Edit HOSTS file option is now in the context menu of (My) Computer.

UNDO INFORMATION
To remove the Edit HOSTS file from the context menu, download EditHosts-Undo.reg and apply it.
MORE INFORMATION
To recollect things, we’ve used the runas verb in the past to do the following:
RELATED POSTS
- Adding the Run as Administrator option for .VBS and .JS files
- Search… context menu option removed in Vista Service Pack 1
- How to Take Ownership of a file or folder using command-line in Windows Vista?
- “Copy Target URL” context menu option for Internet Shortcut (.url) files
- Open an elevated Command Prompt from the Desktop context menu
Bookmark this Page!BlinkList | del.icio.us | Digg it | Furl | reddit | Spurl | StumbleUpon | Wink |


If you enjoyed this post, make sure you
Prefer an E-mail subscription?
Pingback by Adding the Run as Administrator option for .VBS and .JS files - The Winhelponline.com Blog on 27 March 2008:
[...] Add “Edit HOSTS file” option in the context menu [...]
Pingback by How to Take Ownership of a file or folder in Windows Vista? - The Winhelponline Blog on 3 May 2008:
[...] a file or folder from the context menuAdding the Run as Administrator option for .VBS and .JS filesAdd “Edit HOSTS file” option in the context menuRegister DLLs (elevated) using the context menuOpen Command Window Here - Make available from folder [...]