且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法在现有的CSV文件中添加额外的列

更新时间:2023-12-01 11:31:52

您需要将属性添加到对象:

You need to add the property to the objects:

$a= import-csv -path c:\filename.csv -header Name,Id
foreach($item in $a){
    Add-Member -Input $item -MemberType NoteProperty -Name Date -Value '2018-03-28'
}
$a | Select-Object Date, Name, ID | export-csv -path c:\outfile.csv -Notypeinformation