How to remove lines from File A that are in File B using Windows powershell : <p><a href="https://stackoverflow.com/questions/19816914/how-to-join-two-text-files-removing-duplicates-in-windows">This other question</a> is excellent for joining two files.  I need to do sort of the opposite.  I need to remove lines from File A that are in File B, using powershell.</p>

<p><em>This</em> question is similar to <a href="https://stackoverflow.com/questions/21580073/delete-lines-from-file-a-that-is-in-file-b">this other question</a>, except that question is for unix and this is for Windows 7 powershell.</p>

<p>The files are hosts files.  Each one has lines consisting of:</p>

<ul>
<li><code>127.0.0.1   host.domain.com</code></li>
</ul>

<p>or</p>

<ul>
<li><code>0.0.0.0   host.domain.com</code></li>
</ul>

<p>or</p>

<ul>
<li><code># this is a comment</code></li>
</ul>

<p>Files may have up to 200,000 lines.  Spaces and tabs may be present.</p>

<p>Although I prefer it to be preserved, order does not effect function.</p>

<p>Here are some examples of hosts files:</p>

<ul>
<li><a href="https://adaway.org/hosts.txt" rel="nofollow noreferrer">https://adaway.org/hosts.txt</a></li>
<li><a href="https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&amp;showintro=0&amp;mimetype=plaintext" rel="nofollow noreferrer">https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&amp;showintro=0&amp;mimetype=plaintext</a></li>
<li><a href="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" rel="nofollow noreferrer">https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts</a></li>
<li><a href="https://hosts-file.net/ad_servers.txt" rel="nofollow noreferrer">https://hosts-file.net/ad_servers.txt</a></li>
<li><a href="http://winhelp2002.mvps.org/hosts.txt" rel="nofollow noreferrer">http://winhelp2002.mvps.org/hosts.txt</a></li>
<li><a href="http://someonewhocares.org/hosts/hosts" rel="nofollow noreferrer">http://someonewhocares.org/hosts/hosts</a></li>
</ul>

<p>(Don't worry about <code>0.0.0.0</code> vs <code>127.0.0.1</code> for this question.)</p>
