I have this problem which makes me crazy:
i have a function like
function xyz
{
foreach($x in $input)
{
}
}
1..10 | xyz
this is saved in a file test.ps1. When I execute it like ".\test.ps1" every time it writes that
cmdlet Write-Output at command pipeline position 1
Supply values for the following parameters:
InputObject[0]:
Why it is so? It does not work if I do like
$myArray = @("a","b","c")
xyz -arr $myArray
and doing a function like
function xyz
{
param(
[string[]]$arr
)
foreach($x in $arr)
{
}
}
Why?