批处理文件添加字符每行的开头和结尾的TXT文件 [英] Batch file to add characters to beginning and end of each line in txt file
问题描述
嗨我有一个文本文件,我想知道人有一个批处理文件来添加到beninning和,在文本文件中的每一行的结尾?
例如我有
1
2
3
和我想
1
2,
3,
如果一些能贴一个快速它将帮助我出去=)
编辑(从评论到@ mastashake57的职位)
林在Windows上,我appologies如果觉得我是问别人这样做,这是我的。
关闭@echo
SETLOCAL
集addtext =测试
FOR / Fdelims =%%一中(LIST.TXT)做(回声/ |设为/ P = %%一个%addtext%放大器;回声\\&安培;回声)GT;> new.txt
但我不能弄清楚如何把逗号,因为它认为我承担命令或诸如此类的东西的一部分。这个唯一的地方文本中的每一行的字型
关闭@echo
SETLOCAL EnableDelayedExpansion
FOR / F令牌= * delims =%%一中(input.txt的)做(
集/ A N + = 1
回音^%% A ^,>> output.txt的
)
-joedf
Hey guys I have a text file, I was wondering anyone have a batch file to add " to the beninning and ", at the end of each line in a text file?
For example I have
1
2
3
and I want
"1",
"2",
"3",
If some could paste a quick one it would help me out =)
EDIT (from comment to @mastashake57's post):
Im on windows, My appologies if it felt like i was asking someone to do it, This is what I have.
@echo off
setlocal
set addtext=test
for /f "delims=" %%a in (list.txt) do (echo/|set /p =%%a%addtext% & echo\ & echo) >>new.txt
But i cant figure out how to put commas as it thinks its part of the command i assume or something of that sort. this only places text in the font of each line
@echo off
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in (input.txt) do (
set /a N+=1
echo ^"%%a^",>>output.txt
)
-joedf
这篇关于批处理文件添加字符每行的开头和结尾的TXT文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!