【问题标题】:Append data from one file to another windows command line将数据从一个文件附加到另一个 Windows 命令行
【发布时间】:2020-07-28 12:46:21
【问题描述】:

我有两个文件,分别是 file1 和 file2。

File1的数据如下。

$$NewParameter =

File2有如下数据

23/03/2020 14:34:21

我想要 result 如下文件 1

$$NewParameter = '23/03/2020 14:34:21'

我试过下面的命令。

type file2.txt >> file1.txt

但它给了我没有单引号的预期结果。

有关此命令的任何帮助都会有所帮助。

问候,

马赫什

【问题讨论】:

  • File1File2 每个都只包含一行吗?

标签: windows cmd command-line command-line-arguments


【解决方案1】:

不确定你的最终目标是什么,但这是我能想到的最好的,不使用 for 循环和批处理文件。

如果你想要一行结果

set /p one=<file1.txt & set /p two=<file2.txt & echo %one% '%two%'>File1.txt

如果你想在不同的行上显示结果

set /p two=<file2.txt & echo '%two%'>>file1.txt

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-19
    • 2018-01-09
    • 1970-01-01
    • 1970-01-01
    • 2015-10-17
    • 1970-01-01
    • 1970-01-01
    • 2018-12-06
    相关资源
    最近更新 更多