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

前端 未结 6 1650
执念已碎
执念已碎 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:03

    $a = "This", "Is", "a", "cat"
    
    foreach ( $word in $a ) { $sent = "$sent $word" }
    $sent = $sent.Substring(1)
    
    Write-Host $sent
    

提交回复
热议问题