本帖最后由 WHY 于 2018-2-26 01:53 编辑
- @echo off
-
- rem 源目录
- set "srcDir=E:\Test"
-
- echo;输入数字,逗号隔开,如输入:2,5,-1,-3 提取顺数第2行、第5行,倒数第1行、第3行。
- set /p s=
-
- (for %%i in ("%srcDir%\*.txt") do (
- setlocal enabledelayedexpansion
- for /f "delims=" %%j in ('type "%%i"') do (
- set /a n+=1 & set "_!n!=%%j"
- )
- for %%j in (!s!) do (
- set /a "x = (n+1) * (%%j>>31&1) + %%j"
- for %%k in (!x!) do (echo;%%~ni !_%%k!)
- )
- endlocal
- )) > Result.Log
-
- pause
复制代码
|