0

if 8 lss 1 echo Less

[Nothing displayed]

if 08 lss 1 echo Less

Less

Why?

Rob Nicholson
  • 1,707
  • 8
  • 29
  • 56

1 Answers1

0

Found it I think. 0 is the prefix for octal numbers in cmd.exe (never knew that!) and 08 isn't being interpreted correctly as it's not a valid octal number.

So when I extracted a 1-12 month from a date and did math on it, it failed on months 08 and 09 but worked with 01-07 and 10 & 11. The former being valid octal and the later being decimal.

Gotcha!

Rob Nicholson
  • 1,707
  • 8
  • 29
  • 56