Last active
April 30, 2024 15:54
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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