PowerShell 技能连载 - 隐藏参数
In the previous tip we explained how you can dump all the legal values for a PowerShell attribute. Today we’ll take a look at the [Parameter()] attribute and its value DontShow. Take a look at this function:
在前一个技能中我们介绍了如何导出一个 PowerShell 属性的所有合法值。今天我们将关注 [Parameter()] 属性和它的值 DontShow。我们来看看这个函数:
1 | function Test-Something |
当您运行这个函数时,IntelliSense 只暴露 -Name 参数。-Internal switch 参数并没有显示,然而您仍然可以使用它。它只是一个隐藏的参数:
1 | PS> Test-Something -Name tobias |
PowerShell 技能连载 - 隐藏参数

