I am trying to compare a string that needs to be a case-sensitive compare in a DOS batch script. I cannot figure out how to turn ON the case sensitivity in a IF statement. Here is what I am doing and it is also matching on a lower case "-f", which I am trying to avoid:
SET "ARGS=%*"
IF "%ARGS:-F=%" NEQ "%ARGS%" (
ECHO Pro option -F was found and not allowed.
GOTO :ERROR
)
IF
statement is case-sensitive by default; it should only be case-insensitive with the/I
switch. Have you echoed the values of"!%ARGS%:-F=!"
and"!%ARGS%!"
before yourIF
statement to see what they hold? – LittleBobbyTables Jun 10 at 19:47