Bezug:
DOS (
Microsoft)
Details:
Batch programming isn't really great fun. So, if you get here you are looking for a way to find a string in another string, i.e. check whether a string contains another. And you are searching for a long time already, aren't you?
Don't waste any more time! Here is your solution:
set search=foo
set string=lol foobar roflmao
echo %string% | find "%search%" >nul
if not errorlevel 1 (
echo %string% contains %search%
) else (
echo %string% does NOT contain %search%
)
Happy programming!