首页 > 代码库 > 将数组转换为字符串

将数组转换为字符串

将数组转换为字符串,然后输出到CSV

 1 [array]$array = "abc","dee","riwo" 2 #将数组转换为字符串 3 $b=$array -join "`n"  4  5 $r=$null 6 $r = ""|select a,b 7 $r.a = "aa" 8 $r.b = $b 9 10 $r|export-csv d:\aaa.csv -NoTypeInformation -Encoding default

结果:

 

将数组转换为字符串