Just put quotes around the Environment variable (as you have already done):
if "%DevEnvDir%" == "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\"
The strings you are comparing are fine, the problem is the way you put the opening bracket without a space. That is confusing it.
Works for me…
C:\if "%gtk_basepath%" == "C:\Program Files\GtkSharp\2.12\" (echo yes)
yes