windows 命令提示符 - 输出结果而不覆盖目标文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6065732/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Command Prompt - outputting results without overwriting target file
提问by Ken
I have a situation where I output results from a CLI program:
我有一种情况,我从 CLI 程序输出结果:
e.g. input.exe > output.txt
例如 input.exe > output.txt
Although output.txt already contains text, by default it gets overwritten when using the command above, how can you write the output to output.txt without overwriting existing data?
虽然 output.txt 已经包含文本,但默认情况下,使用上面的命令时它会被覆盖,如何在不覆盖现有数据的情况下将输出写入 output.txt?
回答by Matteo Italia
Use the >>
operator; it appends the output to the existing content of the file.
使用>>
运算符;它将输出附加到文件的现有内容。
input.exe >> output.txt