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:
- Open an elevated Command Prompt from the folder context menu
- Elevate a Vbscript file using the "runas" parameter in ShellExecute
- Register DLLs (elevated) using the context menu
Bookmark this Page!
BlinkList | del.icio.us | Digg it | Furl | reddit | Spurl | StumbleUpon |
Related Posts
- Adding the Run as Administrator Option for .VBS and .JS Files
- Search… Context Menu Option Removed in Windows 7 and Vista Service Pack 1
- Default Programs Editor – A Useful File Association Editor for Windows 7 and Vista
- More on Overriding the “Delete” Command in the Recycle Bin Context Menu in Windows Vista
- BlockThisSite Menu Extension for Internet Explorer
- Add Select All Option to the Context Menu in Windows Vista
- Restore Missing Pin to Start Menu Context Menu Option in Windows XP
- Open an Elevated Command Prompt From the Desktop Context Menu
- Add Quick Launch (Create Shortcut) Option to the Send to Menu in Windows XP/Vista
- How to Remove NVIDIA Control Panel From the Context Menu
If you enjoyed this post, make sure you subscribe to our RSS feed! We feature Tips, Troubleshooting information, Scripts and Utilities for Microsoft Windows Operating Systems!
Prefer an E-mail subscription?

› 
[...] 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 [...]