Redirecting output to multiple files and to stdout

2019-05-04 23:39发布

问题:

I would like to redirect the output from a command to a file and to stdout. I am using Windows XP command line.

I realize that there is a command in linux called tee which will do this, but I want this in windows.

回答1:

Use tee for windows.



回答2:

The first hit when googling windows tee gives UNIX-style tee utility for Windows



回答3:

The simple DOS shell doesn't have the ability to do this simultaneously.
Try using:

Windows PowerShell

or

Cygwin



回答4:

If using tee (one of the various Windows variants) isn't an option and the command isn't long-running or you don't need to do further processing of the output in real time, then

command > file && type file

would do that for you. But only under the mentioned circumstances. You're probably be better off using tee.



回答5:

PowerShell has tee-object (standard alias tee) if you are using a decent shell.