[lang-ref] ( handle_args ) ( powershell )
It 'should handle args' {
# $args (zero-origin)
function command01 {
$args[0] | Should -Be 'A'
$args[1] | Should -Be 'B'
$args[2] | Should -Be 'C'
$args.Count | Should -Be 3
}
command01 A B C
}
It 'should handle args alternative' {
# param(..)
function command01 {
param(
[Parameter(ValueFromRemainingArguments)]
[string[]] $Argv
)
$Argv[0] | Should -Be 'A'
$Argv[1] | Should -Be 'B'
$Argv[2] | Should -Be 'C'
$Argv.Count | Should -Be 3
}
command01 A B C
}