Answer the question
In order to leave comments, you need to log in
How in a bat file with searching, deleting and adding a line?
Need code for bat
Search for string 127.0.0.1 youtube.com in the hosts file
If the string is found, then delete
If there is no string, then add
Ie . like a switch to turn it off youtube
Thank you all!
Answer the question
In order to leave comments, you need to log in
Prepare 2 hosts files, one contains a string, the other does not, and copy them instead of the original one.
The batch file will eventually turn out something like this:
findstr /C:"127.0.0.1 youtube.com" hosts 1>nul 2>&1 && (copy /y hosts.no hosts & exit /b)
copy /y hosts.yes hosts
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question