【发布时间】:2019-03-29 05:37:48
【问题描述】:
是否有关于如何在 PowerShell 函数中将 Object[] 作为参数传递的资源?
这两个函数都是 cmdlet,它们被正确导出,但我在第二个函数中看不到 $Return 对象。
需要类似下面的东西吗?
ParameterAttribute.ValueFromPipeline Property (System.Management.Automation)
# Within PowerShell code
$Return = My-Function -Param "value" # $Return is of type Object[]
$ModifiedReturn = My-SecondFunction -Input $Return
这是我的函数定义:
function My-SecondFunction
{
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[Object[]]$Input
)
begin {}
process
{
Write-Host "test: $Input" # Does not return anything
}
end {}
}
【问题讨论】:
标签: powershell