Export-CSV exports length but not name

前端 未结 5 1270
迷失自我
迷失自我 2020-11-28 12:23

I have this code that I am running from powershell. When I run it without the export-csv i get all the folder names on the screen.

dir | select -expand fulln         


        
5条回答
  •  星月不相逢
    2020-11-28 13:23

    This worked for me:

    $data = @()
    $row = New-Object PSObject
    $row | Add-Member -MemberType NoteProperty -Name "name1" -Value "Test"
    $row | Add-Member -MemberType NoteProperty -Name "name2" -Value 2
    $data += $row
    
    $data | Export-Csv "Text.csv" -NoTypeInformation
    

提交回复
热议问题