Batch file needed to wrap entire column of text in double quotes

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
batchnoob2021
Posts: 1
Joined: 07 Nov 2021 07:36

Batch file needed to wrap entire column of text in double quotes

#1 Post by batchnoob2021 » 07 Nov 2021 07:45

Hi everyone ,

Just joined here to ask this ! I have a text file that has multiple lines without any quotes. I need a batch file that will append a single double quote at the beginning of the first line (not on a separate line by itself , it must be the first character on the first line) I need the same for the very last line position also. So to end up looking like

"One
Two
Three
Four
Five
Six
Seven"

...Therefore wrapping the entire column. I hope you guys can solve this for me as its been driving me nuts ! :)

Thanks in advance !

OJBakker
Expert
Posts: 88
Joined: 12 Aug 2011 13:57

Re: Batch file needed to wrap entire column of text in double quotes

#2 Post by OJBakker » 08 Nov 2021 02:24

Code: Select all

@echo off
> filenew.txt (
   < nul set /p ="""
   type file.txt
   < nul set /p ="""
)
type filenew.txt

Post Reply