if %int% lss 10 set Fint=0%Fint%
if %int% lss 100 set Fint=0%Fint%
if %int% lss 1000 set Fint=0%Fint%
if %int% lss 10000 set Fint=0%Fint%
echo.Formatted %int% is %Fint%
Beware never perform arithmetic comparisons or operations with numbes with leading zeroes as they are interpreted as octals. Use formatted numbers for display only.
echo.substring is %mystring:~2,2%
The general rule is
where m is the position of the substring starting from zero and n its lenght. Both m and n may assume negative value or be omitted. Type Set /? to know more.