Can updating the hosts file in Windows via batch file cause harm?
6,144
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.
Related videos on Youtube
Comments
-
Megaeverything almost 2 years
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.
-
0xC0000022L over 11 yearsIf you want to get rid of Facebook there are better alternatives (addins/extensions) for the various browsers. This will work, but
facebook.com
has so many subdomains it's almost pointless. Also a proxy (Privoxy etc) can filter web sites and will therefore remove any links to facebook, for example. Anyway, without fuzzy matching this makes not much sense and thehosts
file doesn't allow for that. -
cutrightjm over 11 yearsThis will have to be run as administrator to work, in case you didn't know. Also, they could just use facebook.com, the ip address, facebook.us, etc... I would recommend another method.
-
-
Megaeverything over 11 yearsThanks the reason i put the # in there was for that exact reason. some hosts files dont have another line so i put # there to make it start a new line for the actual remapping. becasue that file dosnt count the # as anything. so does the "." make a new line in the file?
-
Dennis over 11 yearsYes,
echo.
(no space betweenecho
and.
) prints a newline. -
Dennis over 11 yearsI checked and the
#
does no harm, but I still think the newline in the cleaner approach.