Saves command output in a file or variable, and displays it in the console. (Tee-Object)

   

# NAME
Tee-Object

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

# SYNTAX
Tee-Object [-FilePath] <string> [-InputObject <psobject>] [<CommonParameters>]

Tee-Object -Variable <string> [-InputObject <psobject>] [<CommonParameters>]

# DESCRIPTION
The Tee-Object cmdlet sends the output of a command in two directions (like the letter "T"). It stores the output in a file or variable and also sends it down the pipeline. If Tee-Object is the last command in the pipeline, the command output is displayed in the console.

# PARAMETERS
-FilePath <string>
Specifies the file where the cmdlet stores the object. Accepts wildcards that resolve to a single file.

Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false

-InputObject <psobject>
Specifies the object input to the cmdlet. Enter a variable that contains the objects or type a command or expression that gets the objects.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false

-Variable <string>
Assigns a reference to the input objects to the specified variable.

Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
System.Management.Automation.PSObject
You can pipe objects to be redirected to Tee-Object.

# OUTPUTS
System.Management.Automation.PSObject
Tee-Object returns the object that it redirected.

# NOTES

You can also use the Out-File cmdlet or the redirection operator, both of which save the output in a file but do not send it down the pipeline.

Tee-Object uses Unicode encoding when it writes to files. As a result, the output might not be formatted properly in files with a different encoding. To specify the encoding, use the Out-File cmdlet.

# EXAMPLE 1

C:\PS>get-process | tee-object -filepath C:\Test1\testfile2.txt

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
83 4 2300 4520 39 0.30 4032 00THotkey
272 6 1400 3944 34 0.06 3088 alg
81 3 804 3284 21 2.45 148 ApntEx
81 4 2008 5808 38 0.75 3684 Apoint
...

# Description
-----------
This command gets a list of the processes running on the computer and sends the result to a file. Because a second path is not specified, the result will be displayed in the console.

# EXAMPLE 2

C:\PS>get-process notepad | tee-object -variable proc | select-object processname,handles

ProcessName Handles
----------- -------
notepad 43
notepad 37
notepad 38
notepad 38

# Description
-----------
This command gets a list of the processes running on the computer and sends the result to a variable named "proc". It then pipes the resulting objects along to Select-Object, which selects the ProcessName and Handles property. Note that the $proc variable includes the default information returned by Get-Process.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=113417
about_Redirection
Select-Object

C:\Windows>powershell get-help Measure-Command -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows-10 / Windows-8.1 & 8 / Windows-7 & Vista / Windows Server 2008-2016
»»»» ColorConsole



 


... Home  
... Impressum
... ColorConsole

... CMD
... Netsh-XP
... Netsh-7
... Netsh-Vista
... Powershell









Download the Windows 7 Starter, Home (Basic Premium), Professional und Ultimate!

... facebook.de
0.109
Kennwort deaktivieren in Windows 10 (Ruhezustand, Energie sparen), aber wie?  / How can i create a New-Folder?  / Wie groß darf mein Youtube Video maximal sein (Datei, Länge)?  / Where is the classic calculator in Windows 10?  / Wie kann ich den hybriden Standbymodus in Windows-7 einschalten/deaktivieren?  / Ich habe eine Sehbehinderung. Kann ich die Schriftgröße verändern?  / Sind Programmverknüpfungen bei Windows 8 (8.1, 10) auf dem Desktop möglich?  / Customize Auto-Play settings in Windows 10, (enable disable)!  / Upgrade Windows 7 or 8.1 to Windows 10, anything else I should know?  / Wie kann man Vista Gadgets ohne Sidebar nutzen?  / Windows Vista Testversion/Trial downloaden?  / Ausgegraut in Windows 7: Zuletzt geöffnete Programme im Startmenü speichern und anzeigen!  /