@echo off
if %1#==# goto _quit
set n=%1
if %n% LSS 10 goto _lss10
if %n% LSS 100 goto _lss100
goto _quit:_lss10
if exist %n%.txt ren %n%.txt 00%n%.txt
if exist 00%n%.txt echo 成功将%n%.txt改名为00%n%.txt!
goto _quit:_lss100
if exist %n%.txt ren %n%.txt 0%n%.txt
if exist 0%n%.txt echo 成功将%n%.txt改名为0%n%.txt!
goto _quit:_quit
@echo off
if [%1]==[$] goto %2
set prog=%0
if [%1]==[] call %prog% $ loop1 0 1 2 3 4 5 6 7 8 9
set prog=
goto end
:loop1
if [%3]==[] goto end
::if exist %3*.txt
if [%3]==[0] call %prog% $ loop2 0 1 2 3 4 5 6 7 8 9
if not [%3]==[0] call %prog% $ loop3 %30 %31 %32 %33 %34 %35 %36 %37 %38 %39
shift
goto loop1
:loop2
if [%3]==[] goto end
if exist %3.txt ren %3.txt 00%3.txt
if not exist 00%3.txt echo Can't rename '%3.txt'
::echo rename '%3.txt' to '00%3.txt'>>out.txt
shift
goto loop2
:loop3
if [%3]==[] goto end
if exist %3.txt ren %3.txt 0%3.txt
if not exist 0%3.txt echo Can't rename '%3.txt'
::echo rename '%3.txt' to '0%3.txt'>>out.txt
shift
goto loop3
:end