A lot of the answers here are referencing the almighty hosts file, and indeed, that is your best bet. Here's an automated solution provided by some smart guys over at StackOverflow that utilizes no third party software. You can bundle this up into a batch file and run as a Windows task that unblocks at certain times and completely forget about it.
This approach has several upsides:
- Simple
- Free (no downloads required)
- Easy to schedule times with Windows Task Scheduler
- OS level blocking of websites
- Enough of a hassle to undo that you will probably stop yourself before you go through with it.
Here's the code for the batch files:
code for blockfacebook.bat
echo 0.0.0.0 www.facebook.com >> c:\windows\system32\drivers\etc\hosts
code for unblockfacebook.bat
@echo off
setlocal enableextensions disabledelayedexpansion
set "file=c:\windows\system32\drivers\etc\hosts"
for /f "tokens=* delims=0123456789" %%a in (
'findstr /n /i /v /c:"facebook" "%file%" ^& type nul ^> "%file%"'
) do (
set "line=%%a"
setlocal enabledelayedexpansion
>>"%file%" echo(!line:~1!
endlocal
)
endlocal
Just copy paste these into Notepad and save with the .bat extension and double click on them to test.
Scheduling a task:
from Microsoft's website:
You must be logged on as an administrator to perform these steps. If
you aren't logged on as an administrator, you can only change settings
that apply to your user account.
If you use a specific program on a regular basis, you can use the Task
Scheduler wizard to create a task that opens the program for you
automatically according to the schedule you choose. For example, if
you use a financial program on a certain day each month, you can
schedule a task that opens the program automatically to avoid the risk
of forgetting to open it yourself.
Open Task Scheduler by clicking the Start button Picture of the Start button, clicking Control Panel, clicking System and Security,
clicking Administrative Tools, and then double-clicking Task
Scheduler. Administrator permission required If you're prompted for
an administrator password or confirmation, type the password or
provide confirmation.
Click the Action menu, and then click Create Basic Task.
Type a name for the task and an optional description, and then click Next.
Do one of the following:
To select a schedule based on the calendar, click Daily, Weekly, Monthly, or One time, click Next; specify the schedule you want to
use, and then click Next.
To select a schedule based on common recurring events, click When the computer starts or When I log on, and then click Next.
To select a schedule based on specific events, click When a specific event is logged, click Next; specify the event log and other
information using the drop-down lists, and then click Next.
To schedule a program to start automatically, click Start a program, and then click Next.
Click Browse to find the program you want to start, and then click Next.
Click Finish.