0

I have a file like with a missing double quote at the start...

1","abc","123"
"2","abcd","456"
"3","abce","789"

I want to run a command to insert a single double quote in to the first position so the file looks like...

"1","abc","123"
"2","abcd","456"
"3","abce","789"
Ian Carrick
  • 242
  • 3
  • 18

1 Answers1

1

Somehow I miss the point, why you need a batch script to change a single file. But here you go:

@echo off
<nul >"new.txt" set /p x="""
>>"new.txt" type "old.txt"
move /y "old.txt" "new.txt"

first: write a " without linebreak ((mis)using set /p)
second: add the original file
third: rename the result to the original filename

Stephan
  • 53,940
  • 10
  • 58
  • 91
  • This solution will be put inside a stored procedure run multiple times a day to resolve the issue so it's not just a one-off this info wasn't really relevant to the post.... – Ian Carrick Jun 14 '17 at 16:15