求bat批处理提取多个文本文件的倒数二行并输出保存到ok.txt。诚心感谢帮忙。谢谢。
对不起,我没表达清楚,应该是==>>提取多个文本文件的倒数第一和第二行输出并保存到ok.txt<<==
您好!对不起,我没表达清楚,应该是==>>提取多个文本文件的倒数第一和第二行并输出保存到ok.txt<<==
追答@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%a in ('dir /b *.txt') do (
set fn=%%a
for /f %%b in ('"type "!fn!""') do set /a no+=1
set /a no1=no-1
for /f "tokens=* delims=" %%b in ('"type "!fn!""') do set /a no2+=1&if !no2! equ !no1! (echo %%b>>ok.txt) else if !no2! equ !no! echo %%b>>ok.txt
set /a no=0
set /a no2=0
)