I have below records in a file:
id user mart desc
-- ---- ----- --------
1 test_1 3 test result 1...
2 test_2 3 test result 2
and I want to write it to a .csv file in powershell with below command:
Get-Content .\test | ConvertTo-Csv -NoTypeInformation | Out-File txt.csv
I am expect a csv file with below value:
id,user,mart,desc
1,test_1,3,test result 1
2,test_2,3,test result 2
but somehow the output csv file is like below:
"PSPath","PSParentPath","PSChildName","PSDrive","PSProvider","ReadCount","Length"
"C:\test","C:\question","test","C","Microsoft.PowerShell.Core\FileSystem","1","126"
"C:\test","C:\question","test","C","Microsoft.PowerShell.Core\FileSystem","2","126"
"C:\test","C:\question","test","C","Microsoft.PowerShell.Core\FileSystem","3","126"
"C:\test","C:\question","test","C","Microsoft.PowerShell.Core\FileSystem","4","126"
Is there any idea why it didnt export the proper value to csv.
I am expect a csv file with below value:
id,user,mart,desc
1,test_1,3,test result 1
2,test_2,3,test result 2