Text 在单个文本文件中保存多个cmd命令的批处理文件的输出

Text 在单个文本文件中保存多个cmd命令的批处理文件的输出,text,batch-file,cmd,Text,Batch File,Cmd,我正在尝试将批处理文件的输出转换为文本文件。我通过使用“>”知道 我可以得到标准的输出流文本,但是在这种情况下,批处理文件有多个cmd命令,我不知道如何将每个命令的输出都放到文本文件中 非常感谢您的帮助 希望这有帮助 @echo off rem start the file with a single > echo test1 > file.txt rem append the file with a double >> echo test2 >> file.

我正在尝试将批处理文件的输出转换为文本文件。我通过使用“>”知道 我可以得到标准的输出流文本,但是在这种情况下,批处理文件有多个cmd命令,我不知道如何将每个命令的输出都放到文本文件中

非常感谢您的帮助

希望这有帮助

@echo off
rem start the file with a single >
echo test1 > file.txt
rem append the file with a double >>
echo test2 >> file.txt
type file.txt

谢谢你的快速回复。因此,通过使用管道,我应该能够找到它。>>是一个双大于号,管道是这个|但是威廉的答案会非常有效。