回复 1# shkm
- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir/a-d/s/b/l/on ".\*.txt"')do (
- for /f "tokens=1,* delims=:" %%j in ('findstr/n . "%%i"')do set "n=%%j"
- set/a "n=!n!-1"
- for /f "tokens=1,* delims=:" %%j in ('findstr/n . "%%i"')do (
- if "%%j"=="2" (
- echo,%%k
- )else if "%%j"=="!n!" (
- echo,%%k
- )else (
- echo,%%k
- )
- )
- )
- pause
复制代码
|