windows 在 win XP 命令行中同时将输出重定向到多个文件和标准输出
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/666815/
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
Redirecting output to multiple files and to stdout simultaneously in win XP command line
提问by Amjith
I would like to redirect the output from a command to a file and to stdout. I am using Windows XP command line.
我想将命令的输出重定向到文件和标准输出。我正在使用 Windows XP 命令行。
I realize that there is a command in linux called tee which will do this, but I want this in windows.
我意识到 linux 中有一个名为 tee 的命令可以执行此操作,但我希望在 Windows 中使用它。
采纳答案by jdigital
Use tee for windows.
回答by JeffH
The first hit when googling windows teegives UNIX-style tee utility for Windows
谷歌搜索windows tee时的第一次命中为 Windows提供了UNIX 风格的 tee 实用程序
回答by Jon W
The simple DOS shell doesn't have the ability to do this simultaneously.
Try using:
简单的 DOS shell 无法同时执行此操作。
尝试使用:
or
或者
回答by Joey
If using tee
(one of the various Windows variants) isn't an option and the command isn't long-running or you don't need to do further processing of the output in real time, then
如果使用tee
(各种 Windows 变体之一)不是一个选项,并且命令不是长时间运行的,或者您不需要实时对输出进行进一步处理,那么
command > file && type file
would do that for you. But only under the mentioned circumstances. You're probably be better off using tee
.
会为你做的。但仅在上述情况下。你可能最好使用tee
.
回答by Richard
PowerShell has tee-object
(standard alias tee
) if you are using a decent shell.
如果您使用的是体面的外壳,PowerShell 具有tee-object
(标准别名tee
)。