How to Block a Website Using Command Prompt

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
Block a website using the Command Prompt tool.
Image Credit: rvlsoft/iStock/Getty Images

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.

Advertisement

Step 1

Shut down all applications and programs on your computer.

Video of the Day

Step 2

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

Step 3

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

Advertisement

Step 4

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

Step 5

Find the line that contains "127.0.0.1 local host."

Advertisement

Step 6

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

Step 7

Save the file. Exit all windows.

Video of the Day

Advertisement

Advertisement

references

Report an Issue

screenshot of the current page

Screenshot loading...