显示Windows命令提示符输出,并将其重定向到一个文件 [英] Displaying Windows command prompt output and redirecting it to a file

查看:1470
本文介绍了显示Windows命令提示符输出,并将其重定向到一个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何运行在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆