显示Windows命令提示符输出,并将其重定向到一个文件 [英] Displaying Windows command prompt output and redirecting it to a file
问题描述
我如何运行在Windows命令提示符下一个命令行应用程序,并且都在同一时间显示,并重定向到一个文件?输出
How can I run a command-line application in the Windows command prompt and have the output both displayed and redirected to a file at the same time?
如果,例如,我是要运行的命令 DIR> test.txt的
,这将输出重定向到一个名为的test.txt
不显示结果。
If, for example, I were to run the command dir > test.txt
, this would redirect output to a file called test.txt
without displaying the results.
我怎么能写一个命令来显示输出和将输出重定向到一个文件在Windows命令提示符下,类似于 T恤
命令在Unix?
How could I write a command to display the output and redirect output to a file in the Windows command prompt, similar to the tee
command on Unix?
推荐答案
我能找到重定向输出的解决方案/解决方法,以一个文件,然后以控制台:
I was able to find a solution/workaround of redirecting output to a file and then to the console:
dir > a.txt | type a.txt
其中 DIR 是输出需要的命令被重定向, A.TXT 的文件在哪里存储输出。
where dir is the command which output needs to be redirected, a.txt a file where to store output.
这篇关于显示Windows命令提示符输出,并将其重定向到一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!