1。行道的冒号会忽略
2。空行没有过滤
3。放在单独的文件夹中执行- @echo off
- (for %%i in (*.txt) do (
- for /f "delims=" %%j in ('findstr /n .* %%i') do echo %%j
- )
- )>c:\temp.txt
- if exist c:\?#.txt del c:\?#.txt
- set /p a=请输入要取的次数
- :1
- set /a n+=1
- (for /f "tokens=1* delims=:" %%i in ('findstr %n% c:\temp.txt') do echo=%%j)>c:\%n%#.txt
- if %n% equ %a% (goto :2) else goto :1
- :2
- del c:\temp.txt
- start c:\
- pause
复制代码
|