HOWTO: Enable/Disable the HOSTS File On-The-Fly
[ 1 March 2007 ]
Marked under time savers, windows.

If you use my previosuly featured method of blocking websites using the HOSTS file, then you probably know it’s annoying to navigate to that file to disable it. Why would you want to disable it you may ask? Well, let’s say you go to a website numerous times and you’re unable to reach it. Other people can see it, but you claim the site is down. Maybe you’re blocking it in the HOSTS file. Well, disabling it is one way to find out. Instead of finding the file and renaming it to disable the blocking, you can run this simple script I wrote. It will enable/disable the HOSTS file and tell you what state the file is in. Toss it in your system32 directory and you can run it from the Run box. The script renames hosts to hosts1 and vice versa

You can download the file (hosts.bat) or you can just copy the script below:

@echo off
cls

cd C:\WINDOWS\system32\drivers\etc

if exist hosts goto two

:one
ren hosts1 hosts
echo.
echo hosts ENABLED
echo.
goto end

:two
ren hosts hosts1
echo.
echo hosts DISABLED
echo.
goto end

:end
pause

HOSTS script
Disable/Enable via the Run box.

hosts DISABLED

hosts ENABLED


2 Comment’s on “HOWTO: Enable/Disable the HOSTS File On-The-Fly”

Paul says:

This on-the-fly method is exactly what I was looking for. Blocking using this method works well most of the time but sometimes causes problems displaying websites. So it’s great to know how to turn it on and off easily, thanks very much.

Kerry says:

I just use Hostman, which has it’s own toggle for the hosts file; it is a whole lot simpler and easier to do than the procedure you describe.

Speak your mind:

Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>









Home

 

Article

 

Recent articles

 

Articles marked as

 

Search

 

 

 

 

spam, email at: spamstudygonewild+atm@gmail.com