【问题标题】:When I combine files with cmd command copy why would there be an extra space at the end of the new file and how can I remove it当我将文件与 cmd 命令复制合并时,为什么新文件末尾会有额外的空间以及如何删除它
【发布时间】:2017-11-26 17:25:13
【问题描述】:

当我将文件与 cmd 命令copy 合并时,为什么新文件末尾会有多余的空间以及如何删除它。

我尝试使用命令copy 将文件与 cmd 和 powershell 结合起来。


cmd命令:

copy /y C:\x1.txt + C:\x2.txt C:\x3.txt

powershell 命令:

cmd /c copy /y C:\x1.txt + C:\x2.txt C:\x3.txt


我得到了我的x3.txt 文件,但x3.txt 末尾有一个额外的空格 为什么会这样?如何使用 cmd 或 powershell 删除多余的空间?

【问题讨论】:

    标签: powershell batch-file cmd


    【解决方案1】:

    我不确定额外的字符是 Space - 我怀疑它实际上是 Ctrl-Z

    copy /y C:\x1.txt + C:\x2.txt C:\x3.txt /B
    

    应该可以解决问题 - 以/B(二进制)模式输出。

    Ctrl-Z 传统上标记文本文件的结尾

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-10
      • 2017-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-11
      • 2022-08-09
      • 1970-01-01
      相关资源
      最近更新 更多