首页 > 代码库 > DIR 按文件名中数字大小进行排序
DIR 按文件名中数字大小进行排序
@echo off set arg=%1 if "%arg%" == "" set arg=* if "%arg%" == "-h" ( echo sort by numbers in filename echo usage: nsort [drive:][path][filename] exit /b ) setlocal EnableExtensions for /F "delims=" %%I in (‘dir %arg% /A-D /B /ON 2^>nul‘) do call :AddToFileList "%%I" for /F "tokens=1* delims==" %%I in (‘set FileList[ 2^>nul‘) do echo %%J endlocal exit /B :AddToFileList set "FileName=%~n1" if "%FileName%" == "" set "FileName=%~x1" set "FileNumber=" :GetFileNumber for /F "delims=0123456789" %%I in ("%FileName:~-1%") do goto AddFileToArray set "FileNumber=%FileName:~-1%%FileNumber%" set "FileName=%FileName:~0,-1%" if not "%FileName%" == "" goto GetFileNumber :AddFileToArray set "FileNumber=00000%FileNumber%" set "FileNumber=%FileNumber:~-5%" set "FileList[%FileName%_%FileNumber%]=%~1" goto :EOFnsort.7z
DIR 按文件名中数字大小进行排序
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。