The Computer Oracle

tee for Windows?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

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

--

Chapters
00:00 Tee For Windows?
00:20 Accepted Answer Score 46
00:43 Answer 2 Score 4
00:54 Answer 3 Score 2
01:03 Answer 4 Score 0
01:11 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