For example, I have 3 files in c:\z
PS C:\z> dir | select name
Name
----
a.png
b.png
c.png
What I want is a string.
a.png,b.png,c.png
Thanks.
If you want an array of strings, all you have to do is to:
dir | select -expand name
If you want that as a single string with the values comma separated:
(dir | select -expand name) -join ","
Just a small improvement, you can get names only with the Name switch:
(dir -name) -join ','
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With