I have a batch script to run different PHP versions under different environments.
@ECHO OFF
setlocal EnableExtensions EnableDelayedExpansion
IF "%ANSICON%" == "" (
php7 %*
) ELSE (
php5 %*
)
The problem is it breaks on the first unescaped closing parenthesis as it matches the opening parenthesis in IF "%ANSICON%" == "" (
.
C:\>php -r echo'()';
' was unexpected at this time.
C:\>php -r echo'(())';
)' was unexpected at this time.
The line setlocal EnableExtensions EnableDelayedExpansion
is new based on other questions I read, but it hasn't changed the behaviour at all.
How can I pass all of %*
to PHP without it being interpreted by batch first?
This batch file exhibits the same behaviour:
@ECHO OFF
setlocal EnableExtensions EnableDelayedExpansion
IF "%ANSICON%" == "" (
echo %*
) ELSE (
echo %*
)