字符串 -> 数组
方法一:
$str = “abcd”$s2 = $str.GetEnumerator() #$s2是无法使用下标的方式进行索引的,因为其不是array$s2 | % {$_ + “y8y”} $str = “abcd”Foreach ($s in $str.GetEnumerator()) {$s + “y8y”} 方法二:$str = “abcd”$str.tochararray()输出结果:ay8yby8ycy8ydy8y 数组 -> 字符串方法一:$info = ‘One’, ‘Two’, ‘Three’$info | Out-String 方法二:$info = Get-Content $env:windir\windowsupdate.log -Raw 参考: http://blog.vichamp.com/powershell/tip/2014/05/19/converting-text-arrays-to-stringhttp://www.cnblogs.com/dreamer-fish/p/3942023.html