Add chararacter to end of each lines except the last one

Viewed 131

I'm trying to convert a file containing json line into a json array. To achieve this I had to append opening and closing square brackets to the file (which is done!). To finish I just need to append a comma to the end of each line except the last one. I'm using the following script, but I don't how to stop at the last line.

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

Thank you by advance for any help!

3 Answers
Related