question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

-NoTypeInformation should be default on Export-Csv

See original GitHub issue

In most situations, the default behavior of Export-Csv is undesirable. Its usage as an object Import and Export is limited to begin with. What it is more commonly used for (in my experience, anyway) is to produce CSV files either to be parsed by other automated processes outside the PowerShell ecosystem or to be used in Excel as human parsable reports. The initial line with the type information is undesirable in those situations.

This is a common “gotcha” for PowerShell novices. It violates the Principle of least astonishment.

I’m curious how many profiles have this $PSDefaultParameterValues['Export-CSV:NoTypeInformation'] = $true. I know I have that in my work profile and at the top of so many scripts.

It’s a minor annoyance and a breaking change, but I just don’t think the default behavior is actually useful.

My tentative proposal is to leave -NoTypeInformation in for backwards compatibility but make it default and add a -IncludeTypeInformation switch to revert to legacy behavior per request.

This issue is for discussion, yays, nays, and possible alternatives for a proposed solution.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:185
  • Comments:42 (18 by maintainers)

github_iconTop GitHub Comments

12reactions
ArtisanByteCraftercommented, Oct 16, 2017

Agreed. If wanted, I’d suggest a -IncludeTypeInformation switch.

3reactions
SteveL-MSFTcommented, Oct 17, 2017

I appreciate the enthusiasm by the community 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

NoTypeInformation is Now Default For Export-Csv and ...
That's right: Starting with PowerShell 6.0.0-Beta.9 -NoTypeInformation will be the default behavior on Export-Csv and ConvertTo-Csv.
Read more >
Export-Csv (Microsoft.PowerShell.Utility)
The UseCulture parameter uses the current culture's default list separator as the delimiter. The NoTypeInformation parameter removes the #TYPE information ...
Read more >
Export-CSV... set NoTypeInformation gloabally for all time ...
This is set by default since PS 6.0. That's why, since that version, this cmdlet has an "-IncludeTypeInformation" parameter.
Read more >
How-to use Export-CSV in PowerShell
NoTypeInformation – Removes the Type information header from the output. Not needed any more in PowerShell 6; Delimiter – Default is comma, but ......
Read more >
PowerShell NoTypeInformation Parameter Explained
The NoTypeInformation removes the #TYPE information header when you use the Export-Csv or ConvertTo-Csv to export PowerShell output to a CSV file. Prior...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found