将单个双引号插入文本文件中第一行的开头

时间:2017-06-14 14:40:48

标签: batch-file cmd

我有一个文件,比如一开始就缺少双引号......

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

我想运行一个命令,将一个双引号插入到第一个位置,这样文件就像......

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

1 个答案:

答案 0 :(得分:1)

不知怎的,我忽略了这一点,为什么需要一个批处理脚本来更改单个文件。但是你走了:

<snippet>
  <content><![CDATA[
  'use strict';

  module.exports = function() {

    var Given = this.Given,
        When = this.When,
        Then = this.Then;

    Given(/^description$/, function(cb) {
        cb();
    });

    When(/^description$/, function(cb) {
        cb();
    });

    Then(/^description$/, function(cb) {
        cb();
    });
  };
  ]]></content>
    <tabTrigger>step</tabTrigger>
    <scope>source.js</scope>
    <description>To create a step in cucumber</description>
</snippet>

首先:使用@echo off <nul >"new.txt" set /p x=""" >>"new.txt" type "old.txt" move /y "old.txt" "new.txt" 写一个"没有换行符(错误) 第二:添加原始文件
第三步:将结果重命名为原始文件名