4

Given

$a = (("a","b","c"),("d","e","f"))

I want $a exported to a csv file like this

a,b,c
d,e,f

Something so simple seems tricky. What's the best way, my file will be less than 40 lines long.

1 Answer 1

3

Try this

$a | % { $_ -join ','} |  out-file .\myfile.csv
Sign up to request clarification or add additional context in comments.

1 Comment

Haha, yeah thanks. I'm just wondering why the Export-Csv only works with objects and not arrays.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.