Help incrementing number with leading zeros - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Help incrementing number with leading zeros

DJXDJX Posts: 1Member
Here is an example piece of code:
SET CurNum="1"
ECHO "%CurNum%"
SET /A CurNum=%CurNum%+1
My question is how would I incement that number with a set of leading zeros that would eventualy null out.

Say I want to have 6 leading zeros:
when it gets to 10, there will be 5 leading zeros, 100 there will be 4 leading zeros and so on.

Thanks for your help, I'm a little rusty on Batch. I have been working on VBScript lately.
Realisticly I'd like to have about 9 or 12 leading zeros...
Sign In or Register to comment.