I\'m trying to see if a string is the same as another string by using if, but the string contains spaces!
It looks something like this:
if %DriveDir%
batch file interpretation is very literal. you are not really using variables, they all get replaced with their values on load. so the line
if %DriveDir%=="NOT BOOT FILES" echo Working
gets expanded to
if NOT BOOT FILES=="NOT BOOT FILES" echo Working
which is obviously syntactically incorrect. you need to have the same expression on both sides, and the NOT
gets parsed as IF NOT…
, so you need to surround both wih quotes.
You should also add quotes to variables.
if "%DriveDir%"=="NOT BOOT FILES" echo Working