title: Find out whether an environment variable contains a substring
body: <p>I need to find out if a certain environment variable (let's say Foo) contains a substring (let's say BAR) in a windows batch file.  Is there any way to do this using only batch file commands and/or programs/commands installed by default with windows?</p>
  
  <p>For example:</p>
  
  <pre><code>set Foo=Some string;something BAR something;blah
  
  if "BAR" in %Foo% goto FoundIt     &lt;- What should this line be? 
  
  echo Did not find BAR.
  exit 1
  
  :FoundIt
  echo Found BAR!
  exit 0
  </code></pre>
  
  <p>What should the marked line above be to make this simple batch file print "Found BAR"?</p>