Agita 0 Junior Poster in Training

So I wanted to write a quick script to block people from going to Facebook in their workpalce.

I already had the command to block a site in the host file, but I don't know how the remove the entrys.

My goal is to have a command that will reverse what my first does. If anyone would be kind enough to explain how to make a script to delete the entrys that my first creates that would be awesome.


Thanks for looking

FIND /C /I "www.facebook.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1				www.facebook.com>>%WINDIR%\system32\drivers\etc\hosts


FIND /C /I "facebook.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1				facebook.com>>%WINDIR%\system32\drivers\etc\hosts

FIND /C /I "static.ak.fbcdn.net" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1				static.ak.fbcdn.net>>%WINDIR%\system32\drivers\etc\hosts

FIND /C /I "www.static.ak.fbcdn.net" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1				www.static.ak.fbcdn.net>>%WINDIR%\system32\drivers\etc\hosts

FIND /C /I "www.login.facebook.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1				login.facebook.com>>%WINDIR%\system32\drivers\etc\hosts

FIND /C /I "fbcdn.net" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1				fbcdn.net>>%WINDIR%\system32\drivers\etc\hosts

FIND /C /I "www.fbcdn.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1				www.fbcdn.com>>%WINDIR%\system32\drivers\etc\hosts


FIND /C /I "fbcdn.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1				fbcdn.com>>%WINDIR%\system32\drivers\etc\hosts

FIND /C /I "static.ak.connect.facebook.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1				static.ak.connect.facebook.com>>%WINDIR%\system32\drivers\etc\hosts

FIND /C /I "www.static.ak.connect.facebook.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1				www.static.ak.connect.facebook.com>>%WINDIR%\system32\drivers\etc\hosts


FIND /C /I "http://en-gb.facebook.com/" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1				http://en-gb.facebook.com/>>%WINDIR%\system32\drivers\etc\hosts