From this website, the OP has noticed a problem.
Consider the following code snippet.
if 1==1 (
set /a result = 2*(3+4)
)
At your first glance, you may think CMD.exe
would process it like so:
14
However, CMD.exe
process like so:
2*(3+4
, the )
after 4 is processed at the end of if
code block)
has appeared!The second step would return Unbalanced parentheses
error.
According to a German CMD.exe's set /?
, we would need to quote arithmetic operations. Here's an example.
Previous | Result |
---|---|
set /a result=2+5*4 | set /a result="2+5*4" |
By the way, according to an English CMD.exe set /?
, quotes are required if logical or modulus operators are present in the expression(although this is not a must-do step).