Reputation: 65
This has been frustrating me for TOO long. It can't be this hard. I've been looking at other people's examples and STILL cannot get two strings to match up in Batch. What am I doing wrong?
SET largeString="c:\programs\test"
SET compareTo="test"
SET smallString=%largeString:~13,4%
if %compareTo%==%smallString% echo YES
So that's literally ALL I'm trying to do. It will never echo YES. I have tried
if "%compareTo%"=="%smallString%"
And
if %compareTo% EQU %smallString%
And
if "%compareTo%" EQU "%smallString%"
I am so frustrated at this x.x Did I miss a space somewhere? Did I add a space somewhere?
Upvotes: 2
Views: 1610
Reputation: 11367
Your quotations are a literal part of the largeString
and compareTo
strings, therefore your sub-string numbers are wrong and the quotations are included in the comparison from the compareTo string.
NOTE: OP updated answer, with new numbers.
Upvotes: 3