Some batch files on Windows use an IF syntax with multiple lines, as below:
if var==rule (
some comands
) else (
else commands
)
Now, Windows Vista x64 decided to put all 32 bits files under "C:\Program Files (x86)". Unfortunately, whenever you use an environment variable (such as PATH) inside a multiple line IF without quotes, the parenthesis inside the variable's value confuses IF, aborting the batch file. For example:
if "%OS%"=="Windows_NT" (
@setlocal
call :set_home
set _ARGS=%*
) else (
set _SCALA_HOME=%SCALA_HOME%
rem The following line tests SCALA_HOME instead of _SCALA_HOME, because
rem the above change to _SCALA_HOME is not visible within this block.
if "%SCALA_HOME%"=="" goto error1
call :set_args
)
A batch file with this will fail even though the line where %SCALA_HOME% appears does not get executed. This is rather annoying. Is there a solution for this?