How to Block Certain Websites From My Command Line

By Fatima Farakh

See snippets from your favorite news sources all in one place on your My Yahoo page.
i Jupiterimages/Pixland/Getty Images

The command line in Microsoft Windows allows you to quickly run a particular command and receive an immediate response from the computer in the window prompt. Specific websites can be blocked from the command line by running a command to open the Windows Hosts file, a text file in Notepad that controls access to the Internet. Adding the website you wish to block to the Hosts file and saving it will prevent any further access to that specific website domain name.

Step 1

Click the "Start" button and select "Run."

Step 2

Type "cmd" without the quotes in the "Open" field and press the "Enter" key or click "OK."

Step 3

Type "notepad c:\WINDOWS\system32\drivers\etc\hosts" without the quotes in the command line window.

Step 4

Scroll to the end of the text file in Notepad.

Step 5

Type "127.0.0.1" without the quotes and then the name of the website you want to block. For example, type "127.0.0.1 website.com" without the quotes to block website.com. Repeat this step for each website you want to block.

Step 6

Click "File" in the Notepad menu bar and then "Save" to save to file when you are finished adding each website.

Step 7

Close Notepad.

Step 8

Close the command line.

×