回复 7# roceys
还是用补齐位数的方法- @echo off
- set "dir=C:\Users\lenovo\Desktop\0"
- set "ext=.jpeg"
- set "str=0000000000"
- (
- for /r "%dir%" %%i in ("*%ext%") do (
- set "n=%str%%%~ni"
- call echo %%n:~-10%%?%%i
- )
- ) >"sort.txt"
- for /f "tokens=2 delims=?" %%i in ('sort "sort.txt"') do echo %%i
- del /f /q sort.txt
- pause&exit
复制代码 如果不生成临时文件- @echo off
- REM dir
- set "dir=C:\Users\lenovo\Desktop\0"
- set "ext=.jpeg"
- REM ext
- set "str=0000000000"
- set "code=(for /r "%dir%" %%i in ("*%ext%"^) do @(set "n=%str%%%~ni" ^& call echo %%n:~-10%%?%%i ^)^) ^| sort"
- for /f "tokens=2 delims=?" %%a in ('%code%') do (
- echo %%a
- )
- pause&exit
复制代码
|