ConvertTo-YTdlpArgumentString

SYNOPSIS

Converts an array of arguments into a single command line string

SYNTAX

ConvertTo-YTdlpArgumentString [-Argument] <String[]> [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

The ConvertTo-YTdlpArgumentString function converts an array of arguments into a single command line string which is safe to hand to System.Diagnostics.Process.

Windows PowerShell 5.1 (.NET Framework) does not support ProcessStartInfo.ArgumentList so every argument is quoted & escaped using the CommandLineToArgvW rules which are also understood by .NET on Linux & macOS.

EXAMPLES

EXAMPLE 1

ConvertTo-YTdlpArgumentString -Argument '--output', '%(title)s - %(id)s.%(ext)s'

Returns: –output “%(title)s - %(id)s.%(ext)s”

PARAMETERS

-Argument

One or more arguments to convert

Type: String[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
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

System.String[]

OUTPUTS

System.String

NOTES

Copyright 1990-2026 Celerium

NAME: ConvertTo-YTdlpArgumentString Type: Private

AUTHOR:  David Schulte
DATE:    2025-11-11
EMAIL:   celerium@Celerium.org

TODO:

https://github.com/Celerium/Celerium.YTdlp