I am attempting to check whether a sub-string occurs within a string. If it does then I dont want to perform the 'if' conditions.
My Problem: My code that checks whether a sub-string occurs within a string is not working. It always thinks that a sub-string does NOT occur within a string when it actually does.
How can I check whether a sub-string occurs within a string in batch?
SET filePath="c:/users/abc/dir1/subdir"
SET excludeDir1="c:/users/abc/dir1"
SET excludeDir2="c:/users/abc/dir2"
REM // If the string excludeDir1 does not occur in filePath AND If the string excludeDir2 does not occur in filePath: continue
if /i NOT x%filePath:%excludeDir1%=%==x%filePath% if /i NOT x%filePath:%excludeDir2%=%==x%filePath% (
REM // Do stuff
)