ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer How-Tos & Tutorials

Reset Your Hosts File

Updated on October 30, 2010

What Is A Hosts File?

A Hosts file allows you to customize the IP addresses that host names resolve to. For example, the actual IP address for as I write this is The IP address for is By adding the following entry to my hosts file, I can redirect (on my pc only) to

This works because Windows checks the Hosts file before it queries any DNS servers, and gives priority to the entries in the Hosts file. This can be particularly useful when you want to block certain domains altogether. To block access to by looping the call back to your own computer, you would enter the following line into the Hosts file:

For a huge list of domains that you may wish to block, visit: MPVS.ORG

Reset Your Hosts File

Your Hosts file may have been hijacked, blocking your computer from accessing important updates for:

  • Microsoft Windows
  • Antivirus Programs
  • Spyware and Adware Programs

You may have to reset your Hosts file to regain control of your internet connection.

Other sites may have also been blocked or redirected. For example, if your browser is set to search from the address bar using the MSN search engine, calls to that search engine may have been redirected to a third party hijacker, giving you unwanted and biased search results instead of the results you expected from MSN.

The Hosts file can be difficult to track down on your computer, because the location of the Hosts file may vary, or it may not be present at all. There may also be other copies of the Hosts file in different locations on a single system.

To find every occurrence of the Hosts file on your system, Search your computer for files named "Hosts". Please note that while the Hosts file is a simple text file, it does NOT have a file extention. The file name is simply "Hosts", not "Hosts.txt" or anything similar.

Common Host File Locations

Common Hosts file locations include:

Windows XP   C:\Windows\system32\drivers\etc\
C:\Windows\Windows 2000   C:\WINNT\system32\drivers\etc\
C:\WINNT\Windows 98   C:\Windows\

Turn Your Hosts File On or Off

HostsOff & HostsON Batch Files

As a quick test and fix for many PCs, I have created a couple of batch files that will simply turn the most common Hosts files OFF or ON by renaming the files. This is not a perfect solution for many reasons, including:

  • Some programs may recreate an original, corrupt Hosts file if it is renamed, recreating the problem you are trying to overcome.
  • There may be entries in your Hosts file that legitimate programs require to work normally.
  • These batch files will not work for you if your hosts file is not located in one of the above locations.

Run the following batch file to rename Hosts files in the above locations to HostsOFF:

HostsOFF Batch File: Save text below as file name HostsOFF.BAT -- Run as Administrator

IF EXIST C:\Windows\system32\drivers\etc\hosts Attrib -r -s -h -a C:\Windows\system32\drivers\etc\hosts
IF EXIST C:\Windows\hosts Attrib -r -s -h -a C:\Windows\hosts
IF EXIST C:\WINNT\system32\drivers\etc\hosts Attrib -r -s -h -a C:\WINNT\system32\drivers\etc\hosts
IF EXIST C:\WINNT\hosts Attrib -r -s -h -a C:\WINNT\hosts

IF EXIST C:\Windows\system32\drivers\etc\hosts REN C:\Windows\system32\drivers\etc\hosts hostsOFF
IF EXIST C:\Windows\hosts REN C:\Windows\hosts hostsOFF
IF EXIST C:\WINNT\system32\drivers\etc\hosts REN C:\WINNT\system32\drivers\etc\hosts hostsOFF
IF EXIST C:\WINNT\hosts REN C:\WINNT\hosts hostsOFF

Run the following batch file to rename HostsOFF files in the above locations back to Hosts.

HostsON Batch File: Save text below as file name HostsON.BAT -- Run as Administrator

IF EXIST C:\Windows\system32\drivers\etc\hosts Attrib -r -s -h -a C:\Windows\system32\drivers\etc\hostsOFF
IF EXIST C:\Windows\hosts Attrib -r -s -h -a C:\Windows\hostsOFF
IF EXIST C:\WINNT\system32\drivers\etc\hosts Attrib -r -s -h -a C:\WINNT\system32\drivers\etc\hostsOFF
IF EXIST C:\WINNT\hosts Attrib -r -s -h -a C:\WINNT\hostsOFF

IF EXIST C:\Windows\system32\drivers\etc\hostsOFF REN C:\Windows\system32\drivers\etc\hostsOFF hosts
IF EXIST C:\Windows\hostsOFF REN C:\Windows\hostsOFF hosts
IF EXIST C:\WINNT\system32\drivers\etc\hostsOFF REN C:\WINNT\system32\drivers\etc\hostsOFF hosts


    0 of 8192 characters used
    Post Comment

    No comments yet.