PowerShell 强制参数
示例
函数的参数可以标记为必需
function Get-Greeting{ param ( [Parameter(Mandatory=$true)]$name ) "Hello World $name" }
如果在没有值的情况下调用该函数,则命令行将提示您输入值:
$greeting = Get-Greeting cmdlet Get-Greeting at command pipeline position 1 Supply values for the following parameters: name: