-
Notifications
You must be signed in to change notification settings - Fork 8.3k
-NoTypeInformation should be default on Export-Csv #5131
Copy link
Copy link
Closed
Labels
Breaking-Changebreaking change that may affect usersbreaking change that may affect usersCommittee-ReviewedPS-Committee has reviewed this and made a decisionPS-Committee has reviewed this and made a decisionIssue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
Metadata
Metadata
Assignees
Labels
Breaking-Changebreaking change that may affect usersbreaking change that may affect usersCommittee-ReviewedPS-Committee has reviewed this and made a decisionPS-Committee has reviewed this and made a decisionIssue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
In most situations, the default behavior of
Export-Csvis 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
-NoTypeInformationin for backwards compatibility but make it default and add a-IncludeTypeInformationswitch to revert to legacy behavior per request.This issue is for discussion, yays, nays, and possible alternatives for a proposed solution.