This article describes how you can set a function to intelligently prompt for parameter values when customizing the PowerShell function. Smart hints for parameter values This feature is a new feature that appears in PowerShell 3.0.
In the PowerShell 3.0 version, a new feature appears, which is the smart hint for parameter values. Of course, it's not just anywhere. Smart Cue parameter values, but only in Ise. Of course, the so-called ISE is an integrated development environment with PowerShell.
So, when we're developing a PowerShell function, how do we set the value of our function to intelligently cue parameters in Ise? Take a look at the following example.
Copy Code code as follows:
function Select-color
{
Param
[Validateset (' Red ', ' Green ', ' Blue ')]
$Color
)
"You chose $Color"
}
OK, as you can see, the above function is very simple. The only thing that has not been seen is the phrase [Validateset (' Red ', ' Green ', ' Blue ')], which is used as a set of valid parameter values. And this collection is exactly the optional parameter value that will appear as a smart prompt.
About PowerShell function Intelligent hint parameter value, this article introduces so many, hope to be helpful to you, thank you!