我正在尝试进行
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下,有一个程序tee提供相同的功能。
你不能。
选项1:
call "script.bat" > "script.log" | type "script.log"
选项2:
获胜http://code.google.com/p/wintee/