I have a variable with the following output in PowerShell. How do I join the result to a string?
For example
$s
Output:
Name
abc
def
ghi
I want the output to be in a single string as below:
Name
abc, def, ghi
I have a variable with the following output in PowerShell. How do I join the result to a string? For example$s Output: Nameabc I want the output to be in a single string as below: Nameabc, def, ghi |
|||||
|
You can join $s using a comma. Try this:
Edit, I noticed you want a space after the comma, so:
Output is this:
Edit, if you want to save the result in $s do the following:
New Edit. I didn't see your code, now it's clearer. Try the following:
|
||||
|