简体   繁体   English

在Windows命令中将两个文件合并为一个文件只会导致第一个文件被复制

[英]Combining two files into a single in windows command only result in the first file being copied

This should be a fairly straightforward operation, but I'm puzzled as to why it is not working. 这应该是一个相当简单的操作,但是我对为什么它不起作用感到困惑。

The following commands in windows results in only the first file being copied to destination file report.rtf Windows中的以下命令导致仅将第一个文件复制到目标文件report.rtf

copy /b *.rtf report.rtf

or 要么

type *.rtf >> report.rtf

If you want to add a second file to an existing file, try 如果要将第二个文件添加到现有文件,请尝试

copy /b report.rtf+secondFile.rtf report.rtf

The "+" should combine them (assuming by "combine" you mean "concatenate"). “ +”应该将它们组合起来(假设用“ combine”表示您是“ concatenate”)。

Changing the report.rtf at the end to another file will let you put them into a new file, of course. 最后,将report.rtf更改为另一个文件,将使您可以将它们放入新文件中。

NOTE: In Windows 8.1 (and probably Windows 7 and Windows 8) doing this as a normal user will not work! 注意:在Windows 8.1(可能是Windows 7和Windows 8)中,以普通用户的身份执行此操作将无效! Instead, run cmd.exe (command prompt) as an Administrator (right-click, Run as Administrator). 而是,以管理员身份运行cmd.exe(命令提示符)(右键单击,以管理员身份运行)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何防止文件在Windows文件系统中被复制或剪切? - How to prevent a file being copied or cut in windows file system? 无法通过Windows命令行重命名复制的文件 - Unable to Rename Copied Files via Windows Command Line 查找是否在C ++中复制文件(在Windows中)? - Finding whether file is being copied or not in C++(in Windows)? 检测正在将文件复制到文件夹中 - Detecting that files are being copied in a folder 在单个Windows命令中移动多个文件 - Move multiple files within in a single Windows command Windows 仅针对文件大小的命令 - Windows command for file size only 在Windows中,如何比较两个文件并仅返回第二个文件中最初存在于第一个文件中的记录? - In Windows, how to compare two files and return just the records missing in the second file that were originally present in the first file? Windows 批处理文件 - 获取用户输入但仅执行第一个命令 - Windows Batch file - getting user input but only the first command gets executed 为什么只执行此 Windows 批处理文件的第一行,而在命令 shell 中执行所有三行? - Why does only the first line of this Windows batch file execute but all three lines execute in a command shell? 如何在 Windows 上使用单个命令执行 .jar 文件? - How to execute a .jar file with a single command on windows?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM