
标题: [文本处理] 批处理如何按在内容生成文本标题和文本内容? [打印本页]
作者: Rasm 时间: 2021-8-2 10:39 标题: 批处理如何按在内容生成文本标题和文本内容?
如果我的 内容是- 12134x
- 121www
- 1223009274a
- 1225698067qq
- 12312ff
- 12315646p
复制代码
想在同目录下创建 文本名字和内容都是 上面内容,一行内容一个文本
以上6行文字就是 6个文本
作者: yakeyun 时间: 2021-8-2 10:53
回复 1# Rasm
@echo off
for /f %%i in (test.txt) do echo,%%i >.\%%i.txt
exit
作者: Batcher 时间: 2021-8-5 22:41
回复 2# yakeyun
避免新创建的文本行尾出现多余的空格- @echo off
- for /f "delims=" %%i in ('type "test.txt"') do (
- >"%%i.txt" echo,%%i
- )
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |