显示Windows命令提示符输出并将其重定向到文件
如何在Windows命令提示符下运行命令行应用程序,并同时显示输出和重定向到文件? 例如,如果我运行命令 dir > test.txt ,这会将输出重定向到一个名为 test.txt 的文件,而不显示结果。 我怎么能写一个命令显示输出 和 输出重定向到在Windows命令提示符下一个文件,类似于 tee 上的Unix命令? #1楼 如果您希望在屏幕上真正看到某些内容,即使将批处理文件重定向到文件,也可以使用以下帮助。 如果将设备CON重定向到文件,也可以使用 例: ECHO first line on normal stdout. maybe redirected ECHO second line on normal stdout again. maybe redirected ECHO third line is to ask the user. not redirected >CON ECHO fourth line on normal stdout again. maybe redirected 另请参见良好的重定向说明: http : //www.p-dd.com/chapter7-page14.html #2楼 我能够找到将输出重定向到文件 然后 重定向到控制台的解决方案/解决方法: dir > a.txt | type a.txt 其中 dir 是需要重定向输出的命令,