My goal is to set %PF% variable to C:\ProgramFiles(x86)\MSBuild\ on x64 machines and to C:\ProgramFiles\MSBuild\ on x86 machines. I can easily achieve that such way
IF DEFINED ProgramFiles(x86) SET PF=%ProgramFiles(x86)%\MSBuild\
IF NOT DEFINED ProgramFiles(x86) SET PF=%ProgramFiles%\MSBuild\
But I want to do that in a single IF ELSE statement.
That one
IF DEFINED ProgramFiles(x86) (SET PF=%ProgramFiles(x86)%\MSBuild\) ELSE (SET PF=%ProgramFiles%\MSBuild\)
fails with unexpected "\MSBuild\" error.
That one
IF DEFINED ProgramFiles(x86) (SET PF="%ProgramFiles(x86)%\MSBuild\") ELSE (SET "PF=%ProgramFiles%\MSBuild\")
runs without errors.
But the result value is not what I need ("%ProgramFiles(x86)%\MSBuild\" - instead of "C:\ProgramFiles(x86)\MSBuild\" on x64 machine for example).
So is that possibe?
if defined ProgramFiles(x86)