Re: Bug in CMD.exe? Parentheses confused
- From: "Eman" <e!m!a!n@xxxxxxxxxxx>
- Date: Fri, 9 Feb 2007 18:47:32 +0300
Rich Pasco wrote:
However, using such an assignment inside a block leads to
confusion, e.g.
if 1==1 (
set /a result = 2*(3+4)
)
which leads to an "Unbalanced parenthesis" error as the
closing parenthesis on the arithmetic expression is
mistaken as the closing parenthesis on the conditional
block.
It's not out of place to escape all suspect on the right of the "set something=" statement. E.g., this would work:
~~
@echo off
if 1==1 (
set /a result = 2*^(3+4^)
)
echo result=%result%
~~
And this one too:
~~
@echo off
if 1==1 (
set /a result =^ ^2^*^(^3^+^4^)
)
echo result=%result%
~~
.
- Follow-Ups:
- Re: Bug in CMD.exe? Parentheses confused
- From: Rich Pasco
- Re: Bug in CMD.exe? Parentheses confused
- References:
- Bug in CMD.exe? Parentheses confused
- From: Rich Pasco
- Bug in CMD.exe? Parentheses confused
- Prev by Date: Bug in CMD.exe? Parentheses confused
- Next by Date: Re: Bug in CMD.exe? Parentheses confused
- Previous by thread: Bug in CMD.exe? Parentheses confused
- Next by thread: Re: Bug in CMD.exe? Parentheses confused
- Index(es):
Loading