删除批处理文件中的第1行

时间:2016-03-17 06:46:00

标签: batch-file

我正在批量构建代码语言,我错过了删除txt文件第一行的方法。这是我到目前为止所得到的:

FOR /F "tokens=* skip=1" %A in ('type "%filename%") do @echo    %%A>> %destinationfile%

但由于某种原因这不起作用。我该怎么做?

2 个答案:

答案 0 :(得分:2)

pnt = col - 1

就是全部,你需要。有关详细信息,请参阅more +1 %filename% > %destinationfile%

答案 1 :(得分:1)

批处理应该是这样的:

@echo off
set filename=log.txt
set destinationfile=dest.txt
If exist %destinationfile% del %destinationfile%
FOR /F "tokens=* skip=1" %%A in ('type "%filename%"') do (@echo  %%A >> %destinationfile%)
start "" %destinationfile%