batch 数字进制的问题

时间:2023-12-17 16:45:02

when set viable to number type in cmd
example: set /a num=0833
echo
%num%

display:
Invalid number.  Numeric constants are either decimal
(17),
hexadecimal (0x11), or octal (021).

reason:
when the number has
prefix with 0, it is octal,  08 and 09 are invalid number.
when the number
has prefix with 0x, it is hexadecimal

0x12 = 18 = 22