Monday, March 03, 2014

Editing Your Host File

On Windows systems that use TCP/IP, you have a host file (c:\windows\system32\drivers\etc\hosts). This file contains hard coded IP addresses for hosts that Windows puts into the DNS Client Cache.Thus it can resolve these host names without having to a DNS lookup. This also means you can over ride the IP address look for the host should you want to.

One issue involved, as Shay Levy points out, is that you need an elevated editor to edit the hosts file. That typically means editing the file, realising you were running Notepad from a non elevated PowerShell window, then re-running PowerShell, rerunning notepad, re-doing the edits, etc.

Shay, in a recent blog post, offers a clever fix – a function that edits the Hosts file, but runs notepad elevated. A neat function. It also has another advantage: you need to type less characters (and you don't need to remember where the hosts file is stored!).

Technorati Tags: ,

No comments: