Skip to content

Instantly share code, notes, and snippets.

@Skinner927
Last active April 30, 2024 15:54
Show Gist options
  • Save Skinner927/335877aa6c20bbf1d846d3a6dc0ca706 to your computer and use it in GitHub Desktop.
Save Skinner927/335877aa6c20bbf1d846d3a6dc0ca706 to your computer and use it in GitHub Desktop.
Powershell Glob Args: Last argument catches all parameters regardless of what its named
[CmdletBinding(PositionalBinding=$False)]
param(
[int]$Port = 1234,
[string]$File = $null,
[Parameter(ValueFromRemainingArguments=$True)]
[string[]]${-} = ""
)
$Text = ${-} -join " "
Write-Host "Port $Port"
Write-Host "File $File"
Write-Host "Text $Text"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment