title: Batch findstr condition
body: <p>I've searched through quite a few answers, and can't seem to find what I'm looking for, so pardon me if it has been answered already. I've also never posted here, so excuse me if my formatting is wrong. </p>
  
  <p>I'm trying to determine the OS of a server, either 2003 or 2008, and run a command based on the result. The .bat always goes straight to ":last". Here's what I have - </p>
  
  <pre><code>@echo off
  cd\
  set output="c:\osout.txt"
  del %output%
  set /p osinfo=Server? 
  
  wmic /node:%osinfo% os get caption &gt; "c:\osout.txt"
  
  
  findstr "2003" "c:\osout.txt"
  IF %ERRORLEVEL% EQU 0 GOTO ver2003
  IF %ERRORLEVEL% EQU 1 GOTO next
  :next
  findstr "2008" "c:\osout.txt"
  IF %ERRORLEVEL% EQU 0 GOTO ver2008
  IF %ERRORLEVEL% EQU 1 GOTO last
  :ver2003
  cd\
  cls
  echo ver2003 
  pause
  
  :ver2008
  cd\
  cls
  echo ver2008
  pause
  
  :last
  cd\
  cls
  echo not 2003 or 2008
  pause
  </code></pre>