Sunday 26 August 2012

How To Block Websites using command line batch script

Hi friends, I received many emails asking for how to block website 

using batch file. Because home users cannot afford Firewalls or 

Parental control software's they want security for free, so no need to 

worry, you are at right place I will provide you a fully free website 

blocker...)














OK friends let's Start Creating website blocker 

First open a Notepad

Copy the code below



echo off
title Websites blocker by askmetricks.blogspot.com
echo off
color a
set /p m=Type URL you want to block:
FIND /C /I "%M%" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1                           %M%>>%WINDIR%\system32\drivers\etc\hosts
cls
color b
echo %M% Blocked successfully...
pause




Now paste code into Notepad & save it as Website blocker.bat

Now open Website blocker.bat type URL which you want to block 

& hit Enter...)

That's it... 

Work Smarter... 


11 comments :

  1. Its very good open source application & work very effectively to Block website as a parental control software

    Thank you so much....!

    ReplyDelete
  2. hello , i used this below code, but it's not working.. i don't know, If anything changes need to done, please let me know..

    echo off
    title Websites blocker by askmetricks.blogspot.com
    echo off
    color a
    set /p m=Type URL you want to block:http://www.awwwards.com/
    FIND /C /I "%M%" %WINDIR%\system32\drivers\etc\hosts
    IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1 %M%>>%WINDIR%\system32\drivers\etc\hosts
    cls
    color b
    echo %M% Blocked successfully...
    pause

    ReplyDelete
  3. Just use the code below for writting batch file

    echo off
    title Websites blocker by askmetricks.blogspot.com
    echo off
    color a
    set /p m=Type URL you want to block:
    FIND /C /I "%M%" %WINDIR%\system32\drivers\etc\hosts
    IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1 %M%>>%WINDIR%\system32\drivers\etc\hosts
    cls
    color b
    echo %M% Blocked successfully...
    pause




    Dont add your URL (http://www.awwwards.com/) in batch script because you have to put URL When you run the Batch File


    ReplyDelete
  4. how do you unblock the website after blocking it?

    ReplyDelete
  5. go to C:\Windows\System32\Drivers\etc folder

    you will find hosts file

    open it with notepad

    & delete the entry /URL of your website that you want to unblock

    ReplyDelete
  6. your coding is use full

    how to block category wise for example video sites

    ReplyDelete
  7. sir How to block file download using batch file

    ReplyDelete
  8. how to block download file

    ReplyDelete
  9. This comment has been removed by a blog administrator.

    ReplyDelete
  10. This does NOT work

    ReplyDelete
  11. This comment has been removed by a blog administrator.

    ReplyDelete