title: Batch how to set FINDSTR result to a variable and disable findstr print to console
body: <p>My batch program </p>
  
  <pre><code>FINDSTR  /C:"Result Comparison failure"  %tmp_result_file% 
  </code></pre>
  
  <p>I want to do the folloiwng , set the result of the above command to a variable. 
  If found, set the first line to varible or set the all found line to a varible is OK for me. </p>
  
  <p>also the above commmand will print the findstr command to console even @echo off. is there any method to disable the print. </p>
  
  <p>thanks a lot </p>
  
  <hr>
  
  <p>part of my script, what i do is run command on every line in sourcefile and put the run result into a tmp file, then use find str to find the failed string to check the run result. </p>
  
  <pre><code>for /f  %%a in (%source_file%) do (
      echo  run %%a &gt;&gt; %output_file%
      call  %run_script_command% %%a &gt; %tmp_result_file% 2&gt;&amp;1
      ::notepad %tmp_result_file%
        for /f %%i in ('FINDSTR /C:"Result Comparison failure"  %tmp_result_file%') do  echo %%ixxx
      echo xx
  )
  </code></pre>
  
  <p>very strange , the result is: </p>
  
  <pre>
      xx
      Resultxxx
      xx
  </pre>
  
  <p>the background is that i have two items in <code>%source_file%</code>, so the out for run 2 times.<br>
  for the first one, the FINDSTR can not find anything, so print <code>xxx</code><br>
  for the second one, it find one in findstr , but only print "<code>Result</code>" instead of "<code>Result Comparison failure</code>", also the xx is print before it in result. Very Strange!</p>