How to Block a Website Using Command Prompt

By Brendan O'Brien

One way of blocking your computer from accessing a specific website is with the Microsoft Windows Command Prompt utility. This feature comes in handy when you want to make sure your children are not going to their favorite websites when they should be studying.

Step 1

Shut down all applications and programs on your computer.

Step 2

Press the "Windows-R" keys at the same time.

Step 3

Type "cmd" in the field and select the "OK" button.

Step 4

Type "notepad C:/Windows/System32/drivers/etc/hosts" in the command window.

Step 5

Find the line that contains " local host."

Step 6

Type " URL" on the next line, with "URL" being the site you want to block. For example, if you want to block CNN, type ""

Step 7

Save the file. Exit all windows.

Tips & Warnings

  • Add each URL that you want to block on a new line in the hosts text file you open with the Command Prompt.
  • Most Web browsers also let you block specific website addresses under the "Privacy" or "Security" settings tabs.