The HOSTS file is a file used to map IP addresses to domains. There are many uses for it — my favorite it to block ad servers. The HOSTS file has no extension, so you can’t associate a program with it automatically to open it all the time. Instead, you can create a shortcut that calls a text editor of your choice to open it.
Create a desktop shortcut with the following program path to open the HOSTS file in Notepad:
notepad "c:\windows\system32\drivers\etc\hosts"
Create a desktop shortcut with the following program path to open the HOSTS file in WordPad:
"c:\program files\windows nt\accessories\wordpad.exe" "c:\windows\system32\drivers\etc\hosts"
If you want to auto-open it in any other editor, just change the first path to the program editor’s main executable.
Once you have your shorcut, rename it to hosts and drop it in C:\windows\ so you can run it from the Run box by entering in hosts and hitting enter.
Watch a screen cast of it right now:[kml_flashembed movie=”http://www.allthingsmarked.com/storage/hosts.swf” height=”483″ width=”413″ /]
You can use this in the run box also and it does open it automatically without it asking for association.
notepad %systemroot%\system32\drivers\etc\hosts