本帖最后由 qixiaobin0715 于 2024-9-29 09:17 编辑
6楼代码未考虑重名问题,这样简单一些:- @echo off
- set n=10000
- for /f "delims=" %%i in ('dir /b /ad') do (
- pushd "%%i"
- setlocal enabledelayedexpansion
- for /f "delims=" %%j in ('dir /b /a-d *.jpg,*.png,*.bmp,*.jpeg,*.gif 2^>nul') do (
- set /a n+=1
- ren "%%j" "!n:~1!%%~xj1"
- )
- for %%j in (jpg,png,bmp,jpeg,gif) do (if exist *.%%j1 ren *.%%j1 *.%%j)
- endlocal
- popd
- )
- pause
复制代码
|