Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在windows中将命令输出保存到文件中,并在终端上显示输出?_Windows_Shell_Command Line - Fatal编程技术网

如何在windows中将命令输出保存到文件中,并在终端上显示输出?

如何在windows中将命令输出保存到文件中,并在终端上显示输出?,windows,shell,command-line,Windows,Shell,Command Line,我想将命令的输出保存在文件中,并在终端上显示输出 为了将输出保存到文件,我使用以下命令: >> ps -ef > D:\temp.txt ps -ef 2>&1 | tee D:\temp.txt 但这会将输出保存到文件中,但不会显示在终端上。我应该使用哪个命令来执行这两项要求?使用MinGW,然后使用以下命令: >> ps -ef > D:\temp.txt ps -ef 2>&1 | tee D:\temp.txt 这会

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

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

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

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

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

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

这会奏效的

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