Windows – Can updating the hosts file in Windows via batch file cause harm

filesystem-corruptionhosts-filewindows 7

I have this script that I have saved as a .bat file. Can it hurt a computer?

echo # >> %Windir%\System32\drivers\etc\hosts
echo 0.0.0.0    www.facebook.com >> %Windir%\System32\drivers\etc\hosts

I was just wondering if this can have any side effects on the computer at all like a corruption of something? I don't think it is possible. All it does is make Facebook show a DNS error by changing the hosts file.

Best Answer

Normally I've seen people use localhost instead of 0.0.0.0. I don't know the reason for this; but it shouldn't be a big deal.

Other than that; this script is completely okay. Note that you will not be able to use Facebook after running this script but I think that's what you're trying to accomplish.