0
在PowerShell 2中,我有一个函数Get-CurrentQuarter返回当前季度。如何将函数的默认参数设置为PowerShell 2中另一个函数的输出?
我有另一个功能,需要参数季度。我希望它使用函数Get-CurrentQuarter默认为当前季度。
我想:
function Test-ParameterByFunction
{
param(
[string]$quarter = Get-CurrentQuarter
)
}
Test-ParameterByFunction
PowerShell的报道:
PS > .\test.ps1
Missing expression after '='.
At .\test.ps1:4 char:23
+ [string]$quarter = <<<< Get-CurrentQuarter
+ CategoryInfo : ParserError: (=:String) [], ParseException
+ FullyQualifiedErrorId : MissingExpressionAfterToken
这将是在清理我的代码非常方便。是否有一些我失踪的语法?
谢谢!
谢谢,这似乎做它。 :-) – flickerfly