question

WillPittenger avatar image
0 Votes"
WillPittenger asked WillPittenger answered

Using tee-object with the output from an exe

I'm trying to record the output of yt-dlp to both a log file and see that output on screen. I thought tee would let me do that. I have (yt-dlp something) *>&1 | tee filename.log. It attempts to write the log file only after yt-dlp returns. Plus, nothing appears in the meantime. Do I have something wrong in my PowerShell code?

windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered

What happens if you remove the parentheses surrounding the "yt-dlp something"? Putting that inside parentheses will cause yt-dlp to run to completion (just as any code would because those parens say "do this first") before anything else happens.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

WillPittenger avatar image
0 Votes"
WillPittenger answered

It was passing the rest of the line to yt-dlp. Or at least from what I could see. yt-dlp was complaining about a parameter it didn't know: tee.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered

Try using an explicit reference to the EXE file. For example (this works):

 PS C:\windows\system32> .\ping.exe 127.0.0.1 | tee c:\junk\x.txt
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

WillPittenger avatar image
0 Votes"
WillPittenger answered

I don't know why it seemed to be passing all that to yt-dlp. I took the parentheses out and it worked.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.