The Computer Oracle

tee for Windows?

-------------------------------------------------------------------------------
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
-------------------------------------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Isolated

--

Chapters
00:00 Question
00:27 Accepted answer (Score 39)
01:04 Answer 2 (Score 2)
01:19 Answer 3 (Score 0)
01:34 Thank you

--

Full question
https://superuser.com/questions/74127/te...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#shell #powershell #stdout

#avk47



ACCEPTED ANSWER

Score 46


PowerShell sure does, the cmdlet is called Tee-Object. You can also use the alias tee if you're more used to the Unix-like approach:

PS C:\Documents and Settings\Administrator> help Tee-Object

NAME
    Tee-Object

SYNOPSIS
    Saves command output in a file or variable and displays it in the console.

example:

C:>get-process | tee -filepath C:\file.txt

this will send the output to C:\file.txt as well as the console.




ANSWER 2

Score 4


I just found a way to use the perl as alternative, e.g.:

CMD1 | perl -ne "print $_; print STDERR $_;" 2> OUTPUT.TEE



ANSWER 3

Score 2


Native port of tee for Windows also exists, for example:

https://github.com/dEajL3kA/tee-win32/tree/master#tee-for-windows




ANSWER 4

Score 0


Use the native tee port from gnuwin32: https://gnuwin32.sourceforge.net/packages/coreutils.htm