In a Windows batch file, I have a string 'abcdefg'. I want to check if 'bcd' is in the string, but I also want each to be in a variable, or pass in a parameter for the string.
This solution comes close, but uses constants rather than variables. Batch file: Find if substring is in string (not in a file)
try one:
set "var=abcdefg"
set "search=bcd"
CALL set "test=%%var:%search%=%%"
if "%test%"=="%var%" (echo %search% is not in %var%) else echo %search% in %var% found
set "var=abcdefg"
set "search=bcd"
echo %var%|findstr /lic:"%search%" >nul && echo %search% found || echo %search% not found