Web Analytics

Windows Guides Feed
    Home Basics Windows 7 Windows Vista Windows XP Software Freebies Forums About Follow via RSS  Follow via Twitter  Follow via Facebook  Follow via Email   

Local Area Network IconAre your children always using Facebook? Or is your brother always using your computer?You will find here a way to control access to websites at certain times.

We will do this in Windows 7 but you can do it in all Windows versions.

This post will use the hosts file and two tasks. The host file is stored in %SystemRoot%\system32\drivers\etc\ and its function is mapping  host names and IP addresses. Before DNS or WINS act the local host do this mapping so is the ideal place for controlling access to Web Pages.

So let start:

Press WinKey + R, type %SystemRoot%\system32\drivers\etc\ and press Enter. You will see something like this:

Etc Folder

Copy and paste the file twice so you will see this:

hosts 2 Copy

Create a new folder named c:\hosts. Move the two copies of the host file and rename it to host.tmp1 and host.tmp2.

Press WinKey + R, type notepad and press Enter, drag and drop host.tmp1 to the open window:

host notepad

Add the following line to the file www.facebook.com and save it.

Now, when your browser looks for facebook.com it will be redirected to your local machine, making the connection impossible.

The idea behind is using the host file that blocks Facebook whenever you want. We also have to create 2 files, that are going to copy the 2 versions of the host file.

For that reason we open a new notepad, use WinKey + R, type notepad and press Enter.

Type the following line:

xcopy /Y hosts.tmp1 hosts

host bat file

and save it to “1.bat”, don’t forget to use the quotes:

bat notepad

Repeat the same with host.tmp2 and create a file named 2.bat. The command line is xcopy /Y hosts.tmp2 hosts. Now we have the files that are going to copy the versions of host file when we want. Copy these 4 files into %SystemRoot%\system32\drivers\etc\ so you finally have these:

host files final

We are going to use the Task Scheduler to execute the bat files.

Type Winkey + R type taskschd.msc /s and press Enter. On the right pane click create basic task. Name it as Restrict Access. Select Daily. Now enter the time you are going to restrict the access to facebook.com. In our case 8:00 pm. Select Start a program and look for 1.bat. You have to type the folder the task is going to start %SystemRoot%\system32\drivers\etc\:

Task Manager Options

Click on Open the properties dialog for this task when I click Finish and press finish. Select the following options:

Task Settings

Repeat the same for 2.bat, but in this case use the time you want to start using the Web Page, for example 5:00 pm.

There you have it, access to websites blocked at certain times.

If you’re not into scripting or doing things as manually as this, be sure to check out the User Accounts and Parental Controls Series (written for Vista but also works for Windows 7.)

Looking for something else?


Get free books and software from Windows Guides


  • Azure
    thanks for the knowledge...
  • Angel Luis
    Thank you for the comment.
blog comments powered by Disqus

Windows Forums

MVP Profile