本帖最后由 qixiaobin0715 于 2024-1-29 10:17 编辑
这样可以不必理会2.txt末尾是否存在空行: | @echo off | | chcp 65001>nul | | set x=4 | | set /a m=x-1 | | setlocal enabledelayedexpansion | | (for /f "delims=" %%i in (1.txt) do ( | | if defined Line4 echo,!Line4! | | for /l %%j in (%m%,-1,1) do ( | | set /a n=%%j+1 | | set Line!n!=!Line%%j! | | ) | | set line1=%%i | | ) | | if defined Line4 ( | | for /f "delims=" %%i in (2.txt) do echo,%%i | | for /l %%i in (%x%,-1,1) do echo,!Line%%i! | | ))>3.txt | | pauseCOPY |
|