【发布时间】:2019-11-02 13:28:43
【问题描述】:
我正在将此 CSV 文件导入 powershell,但它没有导入标题,也没有导入所有列。它只获得第一列,但认为没有标题。我意识到第二行是空的,但这就是软件如何使用我需要处理的数据生成 CSV 文件的方式。
CSV 文件:
#,Labels,Machine Name,System Description,IP,User Logged,Disk Free C
,,,,,,
6,"computers-PRO,Desktop,Office 2010,OS Windows 7,Update Adobe Reader",PRO-MEDASST,91-0-928,172.10.201.111,CHR\\jeniferc,6.3
7,Update Adobe Reader,RED,empty,172.10.201.5,,9.5
8,Update Adobe Reader,SIER,empty,172.10.201.5,,6.8
Powershell 代码:
$computerscsv = import-csv -Path "C:\C Drives Less than 10GB free.csv" #import the csv file
$computerscsv | Format-Table
pause
Powershell 输出:
WARNING: One or more headers were not specified. Default names starting with "H" have been used in place of any missing
headers.
H1
--
6
7
8
任何帮助将不胜感激。
【问题讨论】:
标签: powershell csv import import-csv