익명 04:26

Batch script to write a line in host file to block a website

Batch script to write a line in host file to block a website

Batch script to write a line in host file to block a website

I will be sending this remotely. I know how to do it on my PC manually, but I need the batch command to send remotely to block a website.

Please help

I have tried

@echo off

set hostspath=%windir%\System32\drivers\etc\hosts

echo 0.0.0.0 www.facebook.com >> %hostspath%

exit

but it doesnt work.



Top Answer/Comment:

The correct way to do it is:

@echo off
set hostspath=%windir%\System32\drivers\etc\hosts
echo 127.0.0.1 www.facebook.com >> %hostspath%
echo 127.0.0.1 facebook.com >> %hostspath%
exit

without a .txt extension on the hosts file name.

상단 광고의 [X] 버튼을 누르면 내용이 보입니다