Search the Community
Showing results for tags 'Delete lines from the hosts f'.
HelL0 guyz... neEd sum HeLp in batch.. I hav a batch script that edits my hosts file, i use it to block facebook on my pc temporarily, becuz i want no one to use facebook on my pc except me.. , so when i'm done on my pc, i just run the batch script and facebook get blocked on my pc.. and also i use it for some other purpose.. Here is my batch script: Quote So its just easy to edit my hosts file via this batch script, but its very annoying to revert the change, becuz to get facebook back, i hav to delete these lines from the hosts file, and i do it manually..So my question is;Is there anyway to delet specific lines from the hosts file with a single batch file like this one that add lines..?I think the above script needs a bit change but i dont know how.., all i know is that the above script first scans the hosts file for the specific line, if found then it ignores and proceed to next cammand, if not found then it adds the line.., there is the FIND command,, so i think after FIND command we can add a command something like DEL, so that it wil delete the line instead of adding it..but i cant do it, as i d0nt hav much experience in CMD..and plz do note that i hav anothr batch script that can delete the specific lines but it requires another .txt file which contains the lines.. and i want a single standalone .bat file like the one above that adds the line..Any help will be appreciated..And sorry if found my english bad....Thanx Regards...