有人可以指点我一个资源,可以告诉我如何Object[]在一个powershell函数中传入一个参数?这两个函数都是Cmdlet,它们正在正确导出,但我$Return在第二个函数中看不到该对象.
# Within PowerShell code
$Return = My-Function -Param "value" # $Return is of type Object[]
$ModifiedReturn = My-SecondFunction -Input $Return
Run Code Online (Sandbox Code Playgroud)
这是我的功能定义
function My-SecondFunction
{
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[Object[]]$Input
)
begin {}
process
{
Write-Host "test: $Input" # Does not return anything
}
end {}
}
Run Code Online (Sandbox Code Playgroud) powershell ×1