Tee-Object and an -Append option

  • Follow


The cmdlet Tee-Object has no -Append option for use when a file object is the 
target to be written to.

There is an existing issue for this opened at connect.microsoft.com/PowerShell

  https://connect.microsoft.com/PowerShell/feedback/details/137702

but is has been Closed (Won't Fix) with no comment justifying that action by 
Microsoft.

Should we reinstate a request for a product change to add the -Append option to 
the Tee-Object cmdlet?

  - Larry

0
Reply Larry__Weiss 4/14/2010 8:49:43 PM

On Apr 14, 1:49=A0pm, Larry__Weiss <l...@airmail.net> wrote:
> The cmdlet Tee-Object has no -Append option for use when a file object is=
 the
> target to be written to.
>
> There is an existing issue for this opened at connect.microsoft.com/Power=
Shell
>
> =A0https://connect.microsoft.com/PowerShell/feedback/details/137702
>
> but is has been Closed (Won't Fix) with no comment justifying that action=
 by
> Microsoft.
>
> Should we reinstate a request for a product change to add the -Append opt=
ion to
> the Tee-Object cmdlet?
>
> =A0 - Larry

You could create a Proxy Function for Tee-Object and add this
functionality.
0
Reply qa_warrior 4/15/2010 3:44:12 AM


You can use something like this

Write-output "Text"  | %{out-host; out-file -filepath "$filename" -append}

"Larry__Weiss" wrote:

> The cmdlet Tee-Object has no -Append option for use when a file object is the 
> target to be written to.
> 
> There is an existing issue for this opened at connect.microsoft.com/PowerShell
> 
>   https://connect.microsoft.com/PowerShell/feedback/details/137702
> 
> but is has been Closed (Won't Fix) with no comment justifying that action by 
> Microsoft.
> 
> Should we reinstate a request for a product change to add the -Append option to 
> the Tee-Object cmdlet?
> 
>   - Larry
> 
> .
> 
0
Reply Utf 4/23/2010 12:32:04 PM

Saving to a variable is the more general way to use Tee-Object.
Here's an example of appending to a file.

   dir | tee-object -Variable tee
   out-file tee.out -InputObject $tee -Append

  - Larry


On 4/23/2010 7:32 AM, @lways wrote:
> You can use something like this
> Write-output "Text"  | %{out-host; out-file -filepath "$filename" -append}
>
> "Larry__Weiss" wrote:
>> The cmdlet Tee-Object has no -Append option for use when a file object is the
>> target to be written to.
>> There is an existing issue for this opened at connect.microsoft.com/PowerShell
>>    https://connect.microsoft.com/PowerShell/feedback/details/137702
>> but is has been Closed (Won't Fix) with no comment justifying that action by
>> Microsoft.
>> Should we reinstate a request for a product change to add the -Append option to
>> the Tee-Object cmdlet?
>>
0
Reply Larry__Weiss 4/23/2010 3:41:52 PM

I am having trouble specifying a variable in the form of

   ${C:tee.out}

to Tee-Object.

   dir | tee-object -Variable {C:tee.out}

won't work.

It just creates a variable named C:tee.out instead of
a file named C:tee.out

  - Larry


On 4/23/2010 10:41 AM, Larry__Weiss wrote:
> Saving to a variable is the more general way to use Tee-Object.
> Here's an example of appending to a file.
>
> dir | tee-object -Variable tee
> out-file tee.out -InputObject $tee -Append
>
> - Larry
>
>
> On 4/23/2010 7:32 AM, @lways wrote:
>> You can use something like this
>> Write-output "Text" | %{out-host; out-file -filepath "$filename" -append}
>>
>> "Larry__Weiss" wrote:
>>> The cmdlet Tee-Object has no -Append option for use when a file
>>> object is the
>>> target to be written to.
>>> There is an existing issue for this opened at
>>> connect.microsoft.com/PowerShell
>>> https://connect.microsoft.com/PowerShell/feedback/details/137702
>>> but is has been Closed (Won't Fix) with no comment justifying that
>>> action by
>>> Microsoft.
>>> Should we reinstate a request for a product change to add the -Append
>>> option to
>>> the Tee-Object cmdlet?
>>>
0
Reply Larry__Weiss 4/23/2010 4:54:25 PM

4 Replies
742 Views

(page loaded in 0.087 seconds)

Similiar Articles:
















7/25/2012 6:07:27 AM


Reply: