假设我有以下符合预期的批处理命令。
file1.exe | file2.exe
现在,我有以下要求。-应该将file1.exe中的Stderr写入日志文件-应该将file2.exe中的Stderr和Stderr写入日志文件
这也有效
file1.exe 2>>file1.log | file2.exe >>file2.log 2>&1
但是,我真正想要的是将两个输出都放在同一个文件中。这失败,因为file.log
被另一个进程使用
file1.exe 2>>file.log | file2.exe >>file.log 2>&1
这是一个真实的例子来说明这个问题。
echo test 2>>file.log | findstr t 1>>file.log 2>&1
试试这个:
( echo test | findstr t ) >>file.log 2>&1
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句