@echo off
setlocal enabledelayedexpansion
set n=000100
echo Original: %n%
call :RemLeadingZeros %n% n
echo After Call To RemLeadingZeros: %n%
echo.
pause && goto :eof
:RemLeadingZeros
set num=%1
set /a n=0
:tryagain
set newnum=!num:~%n%!
if not defined newnum ( set %2=0 && goto :eof )
if %newnum:~0,1% neq 0 ( set %2=%newnum% && goto :eof )
set /a n+=1
goto tryagain