Rover12421's Blog

The End.

多行写到一行 Bat

1
2
3
4
5
6
@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%a in (1.txt) do (
set /a num+=1
if !num! equ 10 (set/p=%%a>2.txt&echo.>>2.txt&set "num=0") else (set/p=%%a,>2.txt)
)

说明:把文件1.txt里的内容的每十行写成一行到2.txt,之间用“,”分隔。

Comments