@echo off & setlocal enabledelayedexpansion
for /r %%a in (*) do (
echo %%~na|findstr "^[0-9]*$" >nul && (
echo %%~na|findstr "^0" >nul || (
set "Fx="
if %%~na lss 100 set Fx=0
if %%~na lss 10 set Fx=00
ren "%%~a" "!Fx!%%~nxa"
)
)
)
pause
此脚本重复运行,也不会把已经更改好的,再增加0前缀哦!
@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%a in ('dir /b /a-d') do (
set fn=%%a
set /a fn=fn+10000
ren %%a !fn:~-3!
)
pause