The line below:
FOR /f "delims=" %%A IN ('ver') DO @SET WINVERSION=%%A
stores in WINVERSION variable a string that contain several words separated by spaces, for example:
SET WINVERSION=Microsoft Windows [Version 6.2.9200]
This way, the line below:
IF %WINVERSION% == %XP% (
is expanded to:
IF Microsoft Windows [Version 6.2.9200] == Microsoft Windows XP [Version 5.1.2600] (
that, of course, cause a syntax error! Type: IF /?
for further details.
The way to compare two strings that may contains spaces, is enclosing they in quotes:
IF "%WINVERSION%" == "%XP%" (