@echo off
setlocal enableextensions
set vers=0.0
FOR /F "tokens=2 delims== usebackq" %%A IN (
`wmic datafile where name^="C:\\Windows\\System32\\msiexec.exe" get Version /value ^| find "="`
) do set "vers=%%A"
echo %vers%
endlocal
pause
It just asks wmic to output data in the format key=value
, filters the output of the wmic command searching only lines with =
and splits the lines using this character as token delimiter. The first token (the key) is ignored, and second token (the value) is assigned to vers
variable.