How do I convert an array object to a string in PowerShell?

前端 未结 6 1617
执念已碎
执念已碎 2020-12-07 08:45

How can I convert an array object to string?

I tried:

$a = \"This\", \"Is\", \"a\", \"cat\"
[system.String]::J         


        
6条回答
  •  自闭症患者
    2020-12-07 09:13

    I found that piping the array to the Out-String cmdlet works well too.

    For example:

    PS C:\> $a  | out-string
    
    This
    Is
    a
    cat
    

    It depends on your end goal as to which method is the best to use.

提交回复
热议问题