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?
For example:
set Foo=Some string;something BAR something;blah
if "BAR" in %Foo% goto FoundIt <- What should this line be?
echo Did not find BAR.
exit 1
:FoundIt
echo Found BAR!
exit 0
What should the marked line above be to make this simple batch file print "Found BAR"?