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
Related Posts
- Adding the Run as Administrator Option for .VBS and .JS Files
- How to Run a Program Elevated via the Right-Click Menu in Windows 7/Vista?
- 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
- How to Add Quick Launch (Create Shortcut) Option to the Send to Menu in Windows 7, Vista and XP
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?




