There are several techniques to add or remove leading zeroes.
I will list some of these here, all of them intended for unsigned decimal numbers.
To recognize line wrapping, command lines are interlaced with blank lines.
So in the following tables, you should treat command lines not separated by blank lines as a single command line.
Remove Leading Zeroes  

#  Command 
Pros and Cons  
1  SET /A Var = 100%Var% %% 100 


2  SET Var=10%Var% 


3  IF "%Var:~0,1%"=="0" SET Var=%Var:~1% 


4  :Loop 


5  FOR /F "tokens=* delims=0" %%A IN ("%Var%") DO SET Var=%%A 


6  FOR /F "tokens=* delims=0" %%A IN ("%Var%") DO SET /A Var=%%A+0 


7  FOR /F "tokens=* delims=0" %%A IN ("%Var%") DO SET Var=%%A 


8  FOR /F "tokens=* delims=0" %%A IN ("%Var%") DO SET Var=%%A 

Of all techniques to remove leading zeroes presented here, #8 is the preferred one, as it will work for any number, without any restriction.
Add Leading Zeroes  

#  Command 
Pros and Cons  
1  IF %Var% LSS 10 SET Var=0%Var% 


2  IF 1%Var% LSS 100 SET Var=0%Var% 


3  IF 1%Var% LSS 100 SET Var=0%Var% 


4  SET Var=00%Var% 

Of all techniques to add leading zeroes presented here, #4 is the preferred one, as it will work for any number, without any restriction.
Notes:  
(1)  Modulo division method (first command in the first table) by Paul Ruggieri. 
(2)  Math based techniques can be used for numbers up to 9 digits for Windows XP and later, or up to 4 digits for Windows 2000. 
(3)  Math based techniques with "prefixes" can be used for numbers up to 5 digits for Windows XP and later, and only 1 or 2 digits for Windows 2000. 
(4)  All of these commands are intended for digits only, no signs allowed. 
page last uploaded: 20190221, 09:59