回复 25# qd2024 - @echo off
- SETLOCAL ENABLEDELAYEDEXPANSION
-
- cd %~dp0
- set folder=%1
-
- set order16= 08 09 10 07 06 11 12 05 04 13 14 03 02 15 16 01
- for /f "usebackq delims=" %%i in (` dir /b /a-d "%folder%" 2^>nul ^| find /c /v "" `) do (
- set n=%%i
- )
- set order=!order%n%!
-
- echo,
- echo folder: %folder%
- echo file count: %n%
- echo,
-
- pushd %folder%
-
- for /f "usebackq" %%a in (` dir /b .`) do (
- for /f "tokens=2 delims=_" %%a in ("%%~na") do (
- set idxScan=%%a
- )
- call :C_idx_scan_to_real order idxScan idxReal
- echo ren %%a !idxReal!%%~xa
- )
-
- popd
-
- echo,
- echo, ----complete----
- echo,
-
- pause
- exit/b
-
- :C_idx_scan_to_real
- setlocal
- set order=!%1!
- set idx=!%2!
-
- set /a i=0
- for %%a in ( %order% ) do (
- set /a i+=1
- if "!i!" == "%idx%" set idx=%%a
- )
-
- (
- endlocal
- set %3=%idx%
- )
- goto :eof
复制代码
|