Invoke-YTdlpProcess
SYNOPSIS
Runs an executable & streams its output
SYNTAX
Invoke-YTdlpProcess [-FilePath] <String> [[-ArgumentList] <String[]>] [-CaptureOutput]
[[-IgnoreExitCode] <Int32[]>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
The Invoke-YTdlpProcess function runs an executable using System.Diagnostics.Process so that the behavior is identical in Windows PowerShell 5.1 & PowerShell 7+ on Windows, Linux, & macOS.
- Output is read as UTF-8 so non-ASCII video titles are not corrupted
- Standard output is streamed as it arrives, either to the information stream or to the pipeline
- Standard error is converted to warning, verbose, & error messages
- A non-zero exit code throws an error
The information stream is only visible when $InformationPreference is Continue, Invoke-YTdlp sets it unless -InformationAction is supplied by the caller.
EXAMPLES
EXAMPLE 1
Invoke-YTdlpProcess -FilePath 'C:\yt-dlp.exe' -ArgumentList '--version' -CaptureOutput
Runs yt-dlp –version & returns the output
PARAMETERS
-FilePath
The full path to the executable to run
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ArgumentList
The arguments to pass to the executable
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: @()
Accept pipeline input: False
Accept wildcard characters: False
-CaptureOutput
Returns the standard output lines to the pipeline instead of writing them to the information stream
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-IgnoreExitCode
Defines exit codes which should not be treated as an error
Type: Int32[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: @()
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
N/A
OUTPUTS
System.String
NOTES
Copyright 1990-2026 Celerium
NAME: Invoke-YTdlpProcess Type: Private
AUTHOR: David Schulte
DATE: 2025-11-11
EMAIL: celerium@Celerium.org
TODO: