Web Analytics

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.)

About Angel Luis

I am an Engineer of Telecommunications that love computers. My first computer was a Commodore 16kb, about 25 years ago and since then I am always fighting computers problems. Please visit my entries and ask me about whatever problem you have, I will be pleased to help you. My email is discoveryourpc [at] gmail [dot] com. You can follow me on twitter @agenlu or read my blog www.discoveryourpc.net

Free PC tips by email

Search Windows Guides


8 thoughts on “How To Control Access to Specific Websites with Parental Controls”

  1. Azure says:

    thanks for the knowledge…

    1. Boxer-z4in says:

      pure excellence

  2. Angel Luis says:

    Thank you for the comment.

  3. Sal Bass says:

    I tried these instructions but my system is XP. I got a Blue Screen. Yikes!!! Should this work with XP?

    1. Rich says:

      I haven’t personally tested this on XP but it should work. Can you check the system log and give us the details of the blue screen in the forums? We can help you troubleshoot from there.

    2. Angel says:

      Thanks for the comment Sal. Please go to the forums and let us know what has happens. It should work on Windows XP.

  4. Kgjones02 says:

    hi, good article but i’m having some trouble with it at the moment. For some reason the bat file wont run, even if i try to run it manually within the %SystemRoot%system32driversetc folder. I am using my admin acct but everytime I click on either 1.bat or 2.bat a screen pops up and says access denied. if anyone can help me out with this it will be much appreciated. thanks

    1. Angel says:

      I think that your problem is related to how Windows 7 acts about the security in that folder.

      If you are an admin you can change the properties on the Security tab so you are not going to have problems with that.

      If you are still having problems please leave a comment and I will change the article.

Comments are closed.

Computer tips in your inbox
Sign up for the Windows Guides newsletter to get PC tips and access to free Windows books (More details)

Subscribe now
Popular Guides

See which sites have been visited on your PC (even if private browsing mode is used)

Create a Windows 7 System Repair Disc

Best Free Anti-malware

Hibernate vs. Sleep vs. Shut-Down

i3, i5, and i7; Dual, Quad, Hexa Core Processors. How to they Differ?

Intel's Ivy Bridge Processor: new Features

Windows Guides on Facebook