- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /b /a-d "*.ts"') do (
- set str=%%i
- set/a n=0,m+=1
- set "_!m!=%%i"
- call:lp
- if !n! gtr !t! set/a t=n
- )
- for /l %%i in (1,1,%m%) do (
- set str=!_%%i!
- for /l %%j in (1,1,%t%) do set "str=/!str!"
- set /!str:~-%t%!=!_%%i!
- )
- for /f "tokens=2 delims==" %%i in ('set /') do echo %%i
- pause&exit
- :lp
- if defined str (
- set/a n+=1
- set str=%str:~1%
- goto lp
- )
复制代码
|