在文本文件的第一行的开头插入单双引号 [英] Insert Single Double Quote Into Start of First Line in Text File
本文介绍了在文本文件的第一行的开头插入单双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个像这样的文件,开始时缺少双引号...
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"
推荐答案
不知为何,您为什么需要批处理脚本才能更改单个文件.但是你去了:
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"
首先:编写不带换行符的"
(使用set /p
的(错误))
第二:添加原始文件
第三:将结果重命名为原始文件名
first: write a "
without linebreak ((mis)using set /p
)
second: add the original file
third: rename the result to the original filename
这篇关于在文本文件的第一行的开头插入单双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文