title: Search for a string in command line output
body: <p>I want to search for the string "<strong>virtual</strong>" in "<strong>system model</strong>" attribute of '<strong>sysinfo</strong>' command. The command should be successful if 'virtual' is found in the <strong>'system model: -------------------------'</strong> i.e. output of the systeminfo. It should not search for 'virtual' in whole output of systeminfo command but should do in system model attribute only.
  For example the command </p>
  
  <pre><code>systeminfo | findstr /i "system model" 
  </code></pre>
  
  <p>I will get something like</p>
  
  <pre><code>System Model:              HP Compaq dc7800p Small Form Factor
  </code></pre>
  
  <p>in the above line of the output i want to search for string virtual, and want to manipulate using errorlevel.  So please help me to do this.</p>
  
  <p>Following is the one I tried which was not correct.
  Or help me if i can use regular expressions</p>
  
  <pre><code>systeminfo | findstr /i /R  "system model: virtual machine" &gt; nul
  if %errorlevel% == 0 (
     echo virtual machine
  ) ELSE (
     echo physical machine
  )
  </code></pre>
  
  <p>Thanks in advance</p>