【问题标题】:How to save command output to a file in windows and show output on terminal also?如何将命令输出保存到 Windows 中的文件并在终端上显示输出?
【发布时间】:2017-01-18 05:53:37
【问题描述】:

我想将命令的输出保存在文件中,并在终端上显示输出。

为了将输出保存到文件中,我使用以下命令:

>> ps -ef > D:\temp.txt

但这会将输出保存到文件中,但不会显示在终端上。我应该使用哪个命令来执行这两个要求?

【问题讨论】:

  • 我也有同样的问题,你解决了吗?在我的情况下,即使这个 (>) 也不会将输出保存到文件中。在 unix/Linux 中,我使用 2>&1 | tee D:\temp.txt 但在 Windows 中不起作用。

标签: windows shell command-line


【解决方案1】:

使用 MinGW,然后使用以下命令:

ps -ef 2>&1 | tee D:\temp.txt

这会奏效。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多