When using command shell scripts that use environment variables that contain parentheses, you may receive an error similar to the following:
\Microsoft was unexpected at this time. ?
This issue can occur because command shell scripts do not support nested parentheses.
For example, this can occur on a 64-bit computer because the PATH variable typically contains "C:\Program Files (x86)" (the location for 32-bit applications).
@echo off
SET VAR=string containing ( and ) ...
IF "y" == "y" (
echo %VAR%
) ELSE (
echo Handling ELSE case here…
)
To work around this issue, change the script to
@echo off
SET VAR=string containing ( and ) ...
IF "y" == "y" (
echo !VAR!
) ELSE (
echo Handling ELSE case here…
)