get last month, set it as a variable and insert in script

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: get last month, set it as a variable and insert in scrip

#16 Post by penpen » 07 Aug 2013 04:07

The problem is that the 08 (and 09) are no valid numbers as a leading 0 tells the interpreter to treat this as an octal value and 08 (and 09 are no valid octal numbers)

This may be fixed for example in this way:

Code: Select all

set /a "bb=1%aa%-101"

penpen

Bowlardo
Posts: 15
Joined: 28 Jun 2012 07:28

Re: get last month, set it as a variable and insert in scrip

#17 Post by Bowlardo » 07 Aug 2013 05:01

penpen wrote:The problem is that the 08 (and 09) are no valid numbers as a leading 0 tells the interpreter to treat this as an octal value and 08 (and 09 are no valid octal numbers)

This may be fixed for example in this way:

Code: Select all

set /a "bb=1%aa%-101"

penpen


Thanks Pen Pen

Post Reply