有很多txt文档,想批处理,删除每个文档的第一行和最后一行,有没有办法?

2024-12-05 04:16:02
推荐回答(1个)
回答(1):

@echo off&setlocal enabledelayedexpansion
for %%i in (*.txt) do (
set "f=%%i"
for /f "usebackq delims=" %%j in ("!f!") do set/a n+=1
set/盯纯毕a n-=2
for /裤纤f "delims=" %%m in ('"type "!f!"|more +1& cd. 2^>!f!"') do set/凯芹a x+=1&if !x! leq !n! echo;%%m>>!f!
set/a n=0,x=0
)
pause