tee for Windows?

37,036

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.

Share:
37,036
Jé Queue
Author by

Jé Queue

Updated on September 17, 2022

Comments

  • Jé Queue
    Jé Queue over 1 year

    Does Windows provide the basic tee facility for copying standard input to an arbitrary set of files and then back out to standard output?

    I generally download a generic tee program, but curious if something like this exists in powershell or something like that?

    • sorin
      sorin about 14 years
      PowerShell is not for everyone so many will prefer to just download tee from unxutils.sourceforge.net
    • Nils
      Nils about 12 years
      What about cmd? I mean w/o downloading external tools is there a way to display the output of a program and write it into a file at the same time?
    • phuclv
      phuclv about 8 years
      powershell is for everyone from Vista and up
  • Joey
    Joey over 14 years
    There are also numerous ports of the original tee to Windows, but those can be easily found by one's favorite Internet search engine.
  • Jé Queue
    Jé Queue over 14 years
    Right, actually I "carry" a zip file with me from environment to environment; tee being part of that toolkit, but just a fundamentally useful facility I was thinking just HAD to be part of Windows somewhere.
  • Goyuix
    Goyuix over 14 years
    The powershell tee isn't quite identical to the "UNIX / GNU" tee you are familiar with. I would very much recommend carrying around the UnxUtils with you and invoking them in this case.
  • Vomit IT - Chunky Mess Style
    Vomit IT - Chunky Mess Style almost 4 years
    The post seems to ask for a PowerShell solution. Perl doesn't work on Windows in a native fashion so.... hmmmm