title: Remove line from hosts file through BAT script
body: <p>I have written a bat script which will add a line to a hosts file. However I also want to delete any lines which already have the same address. For example:</p>
  
  <p>Add lines 
  192.168.1.1 wwww.google.com</p>
  
  <p>I want to check if there is already a line with www.google.com and remove it.</p>
  
  <p>Can someone explain how to do this please?</p>
  
  <p>My .bat to append a line. I need to edit it to first delete a line then add this one.</p>
  
  <pre><code>@ECHO off
  ECHO. &gt;&gt; %WinDir%\System32\drivers\etc\hosts
  FINDSTR /V "217.168.173.1" "%WinDir%\system32\drivers\etc\hosts"
  ECHO 123.456.7.1   www.google.com &gt;&gt; %WinDir%\system32\drivers\etc\hosts
  EXIT
  </code></pre>