Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ValidateSet values with spaces

Here's an example of ValidateSet where the values are strings which contain spaces:

function Test-ValidateSet
{ 
    param ([ValidateSet("abc def", "ghi jkl")][String]$Val) 

    $Val 
}

The IntelliSense works, however the completed value isn't quoted.

Is there a way to get the completed values to be quoted?

like image 283
dharmatech Avatar asked Oct 21 '25 06:10

dharmatech


1 Answers

It looks like a bug in PowerShell. I've filed it here: https://connect.microsoft.com/PowerShell/feedback/details/812233/auto-completed-values-with-spaces-do-not-have-quotes-around-them


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!