Batch file to add characters to beginning and end of each line in txt file

@echo off
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in (input.txt) do (
set /a N+=1
echo ^"%%a^",>>output.txt
)

-joedf


Off the top of my head, in Linux, you can...

$ for each in `cat filename` ; do echo \"$each\", ; done >> newfilename

"1",
"2",
"3",
"4",
"5",

Edited - since it's for Windows, this did the trick for me:

@echo off
setLocal EnableDelayedExpansion

for /f "tokens=* delims= " %%a in (filename.txt) do (
echo "%%a", >>newfilename.txt
)

Tags:

Batch File

Cmd