如果文件名前17位都是由10位数字+法律具结保证书 构成,可以不用那么麻烦了:- @echo off & setlocal enabledelayedexpansion
- set "b= "
- for /f "delims=" %%a in ('dir /b /on *法律具结保证书*.jpg')do (
- set "a=%%a"
- if "!a:~,17!" == "!b:~,17!" (
- set /a n+=1
- echo,Ren "%%a" "!a:~,17!!n!%%~xa"
- ) else (
- set "n=0"
- echo,Ren "%%a" "!a:~,17!%%~xa"
- )
- set "b=%%a"
- )
- pause
复制代码
|