Powershell格式表转换为CSV [英] Powershell Format-Table to CSV

查看:388
本文介绍了Powershell格式表转换为CSV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Powershell中有以下行来输出数据数组。我遇到的问题是Name,Title,Department不进入列。取而代之的是,我得到一个单列,并且每个行都位于一个单元格之间,并且各分页之间使用制表符。

I have the following line in Powershell to output an array of data. The problem I am having is that Name,Title,Department do not go into columns. Instead I get a single column with each row in a single cell with tabs between.

$outList | Format-Table Name,Title,Department -auto >c:\Scripts\test2.csv

如何输出到列中?

推荐答案

您应该使用Export-Csv cmdlet。

You should be using the Export-Csv cmdlet instead.

$outList | Export-Csv -path c:\scripts\test.csv -NoTypeInformation

如果只需要

$outList | Select-Object -Property Name, Title, Department | Export-Csv -path c:\scripts\test.csv -NoTypeInformation

这篇关于Powershell格式表转换为CSV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆