Add Column to CSV Windows PowerShell

后端 未结 5 1515
野的像风
野的像风 2020-11-28 10:52

I have a fairly standard csv file with headers I want to add a new column & set all the rows to the same data.

Original:

column1, column2
1,b
2         


        
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 11:29

    The ShayLevy's answer also works for me!

    If you don't want to provide a value for each object yet the code is even easier...

    Import-Csv file.csv | 
    Select-Object *,"column3" | 
    Export-Csv file.csv -NoTypeInformation
    

提交回复
热议问题