Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
たとえば、c:\zに3つのファイルがあります
PS C:\z> dir | select name Name ---- a.png b.png c.png
私が欲しいのは文字列です。
a.png、b.png、c.png
ありがとう。
文字列の配列が必要な場合は、次のことを行うだけです。
dir | select -expand name
値をコンマで区切った単一の文字列として使用する場合は、次のようにします。
(dir | select -expand name) -join ","
ほんの少しの改善ですが、名前スイッチを使用した場合にのみ名前を取得できます。
(dir -name) -join ','