title: Why does the errorlevel keeps changing to 1?
body: <p>I have a txt file listing the ports that have printers plugged in on my computer and a <code>findstr</code> to look it up and set one or the other as default printers based upon a string of caracters is found or not in the txt file. The command for setting the default printers are working fine outside of the if clause, but, aparently the <code>findstr</code> is unable to find the string. What am I missing here?</p>
  
  <p>Everytime I run it, it sets the SamsungM printer as the default one, because the <code>ERRORLEVEL</code> is always set to <code>1</code> after running the <code>findstr</code>. Prior to it, it was set to <code>0</code>.</p>
  
  <p>The code:</p>
  
  <pre><code>findstr /I "usb001" ports.txt
  if %ERRORLEVEL% == 0 (wmic printer where portname="USB001" call setdefaultprinter) else (wmic printer where "PortName like '%%samsungm'" call setdefaultprinter)
  </code></pre>
  
  <p>The txt file:</p>
  
  <pre><code>PortName              
  USB001                
  \\ses267827\samsungm  
  172.22.41.49          
  </code></pre>