如何使用 CMD 剪切第一行并将其粘贴到新文件中

How to cut the first line and paste it on new file with CMD

我想将前两行从一个文件移动到另一个文件。有谁知道怎么做? file1.txt > file2.txt

setlocal enabledelayedexpansion
set "count=2"
<file1.txt (
  for /l %%i in (1,1,%count%) do (
    set "line="
    set /p "line="
    echo/!line!
  )
) >file2.txt
more +2 file1.txt > file3.txt
del file1.txt
ren file3.txt file1.txt