You use Export-CSV to export a result to CSV in powershell,
It's a great tool, but it also includes type information in the first line.
For a GCI command, it typically creates something like;
#TYPE System.IO.DirectoryInfo
This breaks a single click open when you want to view the file in something like Excel.
You can tell Export-CSV to stop creating the Type Info by using the switch;
-NoTypeInformation
So, your command ends up something like
gci -recurse | export-csv "20221124.csv" -NoTypeInformation
Comments
Post a Comment