本帖最后由 qixiaobin0715 于 2024-12-26 12:50 编辑
代码未经测试,写的比较匆忙,未仔细检查,你先试试或者把文件传上来测试一下:- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /b /ad') do (
- pushd "%%i"
- set n=1000000
- setlocal enabledelayedexpansion
- for /f "delims=" %%j in ('dir /b /ad') do (
- set "FN=%%j"
- set "FN=!FN:*%%i-=!"
- set /a m=FN
- set /a m=m+n
- for /f "tokens=* delims=0123456789" %%k in ("!FN!") do set "_!m!:%%j=%%k"
- )
- set x=0
- for /f "tokens=2* delims=:=" %%a in ('set _') do (
- set /a x+=1
- ren "%%a" "%%i-!x!%%b"
- )
- endlocal
- popd
- )
- pause
复制代码
|