Here’s a quick sample :
function test-param { [CmdletBinding(DefaultParametersetName="p2")] param( [Parameter(ParameterSetName="p1",Position=0)] [String] $d, [Parameter(ParameterSetName="p2", Position=0)] [String]$i ) switch ($PsCmdlet.ParameterSetName) { "p1" { Write-Host ([DateTime]$d); break} "p2" { Write-Host ([INT]$i); break} } }
For the complete explanation : PowerShell V2: ParameterSets From Jeffrey Snover [MSFT] @ Windows PowerShell Blog
1 comment:
ob702 fake bags oi363
Post a Comment