How to combine multiple arrays to csv file

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.
Post Reply
User avatar
nashman
Posts: 3
Joined: Tue Jan 09, 2018 7:48 am

How to combine multiple arrays to csv file

Post by nashman » Thu Jan 11, 2018 7:32 am

>$a = 1,2,3
>$b = 'x','y','z'
>$c= $a + $b
>$c
1
2
3
x
y
z

What I want is:
1x
2y
3z

Furthermore, I want to export this into csv file with two colums (1,2,3) and (x,y,z).

Thanks!

User avatar
jvierra
Posts: 11743
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: How to combine multiple arrays to csv file

Post by jvierra » Thu Jan 11, 2018 7:39 am

You would have to enumerate the two arrays and generate custom objects. The resulting collection can then be exported to a CSV.

Post Reply