I'm following the answer in Check a string for a substring in a batch file (Windows)?. Wald's answer,
set YourString=This is a test
If NOT "%YourString%"=="%YourString:test=%" (
echo Yes
) else (
echo No
)
does kinda work. However, I'm having trouble changing test= into a variable of my own. I followed another answer of concatenating 2 variables but none of them seemed to work. Basically, I want to check if 'YourString' contains 'OtherString' without a super long amount of code.
Here is the code I have right now
set YourString=This is a test
set OtherString=test
If NOT "%YourString%"=="%YourString:%%=%" (
echo Yes
echo !YourString%OtherString%=!
pause
) else (
echo No
echo "%YourString:test=%"
pause
)