- @echo off
- setlocal enabledelayedexpansion
- set max=0
- set n=0
- for %%i in (*.jpg) do (
- set n=%%~ni
- if !n! gtr !max! (
- set max=!n!
- )
- )
-
- set len=0
- for /f "skip=1 delims=:" %%i in ('^(echo "%max%"^&echo.^)^|findstr /o ".*"') do (
- set /a len=%%i-5
- )
-
- set pre=1
- for /l %%i in (1,1,%len%) do (
- set /a pre*=10
- )
-
- for /f %%i in ('dir /b *.jpg') do (
- set n=%pre%%%~ni
- ren %%i !n:~-%len%!.jpg
- )
复制代码
|