Actually, that one liner doesn't work for windows xp since the ver contains xp in the string. Instead of 5.1 which you want, you would get [Version.5 because of the added token.
I modified the command to look like this:
for /f "tokens=4-6 delims=[. " %%i in ('ver') do set VERSION=%%i.%%j
This will output Version.5 for xp systems which you can use to indentify said system inside a batch file. Sadly, this means the command cannot differentiate between 32bit
and 64bit
build since it doesn't read the .2 from 5.2 that denotes 64bit
XP.
You could make it assign %%k
that token but doing so would make this script not detect windows vista, 7, or 8 properly as they have one token less in their ver string. Hope this helps!