Windows 是否可以在批处理脚本中同时显示和重定向标准输出?

Windows 是否可以在批处理脚本中同时显示和重定向标准输出?,windows,cmd,batch-file,Windows,Cmd,Batch File,我正在努力 call script.bat > script.log 但它不会在控制台中显示结果。 所以现在我要做什么 call script.bat call script.bat > script.log 这是非常低效的 是否有一种方法既可以将输出显示到控制台,又可以将其输出到日志文件? 我知道其中一个选择是 call script.bat > script.log type script.log 但是,如果script.bat只是长批处理过程中的一个步骤,那

我正在努力

  call script.bat > script.log
但它不会在控制台中显示结果。 所以现在我要做什么

 call script.bat
 call script.bat > script.log
这是非常低效的

是否有一种方法既可以将输出显示到控制台,又可以将其输出到日志文件? 我知道其中一个选择是

call script.bat > script.log
type script.log

但是,如果script.bat只是长批处理过程中的一个步骤,那么这就不起作用了。我希望在调用时看到每个步骤的输出,而不是在所有调用结束时执行一次类型

如果您使用windows Power Shell(正如我假设的windows标记),则有一个名为Tee Object的cmdlet

help Tee-Object

NAME
    Tee-Object

SYNOPSIS
    Saves command output in a file or variable and displays it in the console.
在Unix下,有提供相同功能的programm tee。

您不能

备选案文1:

call "script.bat" > "script.log" | type "script.log"
备选案文2:

wintee

目前仅在基本Win XP cmd上使用。但是谢谢你让我知道关于Power Shells的情况。在这种情况下,你可以使用第三方程序。在下面的工具中,您可以找到unix tee的本机win32端口。