07-21-2023, 08:34 PM
I want to pass in a comma separated list of values into a script as part of a single switch.
Here is the program.
param(
[string]$foo
)
Write-Host "[$foo]"
Here is the usage example
PS> .\inputTest.ps1 -foo one,two,three
I would expect the output of this program to be `[one,two,three]` but instead it is returning `[one two three]`. This is a problem because I want to use the commas to deliminate the values.
Why is powershell removing the commas, and what do I need to change in order to preserve them?
Here is the program.
param(
[string]$foo
)
Write-Host "[$foo]"
Here is the usage example
PS> .\inputTest.ps1 -foo one,two,three
I would expect the output of this program to be `[one,two,three]` but instead it is returning `[one two three]`. This is a problem because I want to use the commas to deliminate the values.
Why is powershell removing the commas, and what do I need to change in order to preserve them?