From 3dddc0c8e66bace6adfb20116bdfaf3849f63008 Mon Sep 17 00:00:00 2001 From: surfingoldelephant <151538956+surfingoldelephant@users.noreply.github.com> Date: Fri, 2 Jan 2026 20:32:37 +0000 Subject: [PATCH 1/3] Clarify `PSNativeCommandPreserveBytePipe` is mainstream (#12619) * Clarify experimental feature is mainstream Previous verbiage in about_Pipelines wasn't clear that PSNativeCommandPreserveBytePipe is mainstream in PS 7.4. * Fix wrong feature link in 7.4 release notes PSNativeCommandPreserveBytePipe was using the wrong link reference (10 rather than 11). The linked doc has also been changed to `about_Pipelines`, as this explicitly mentions the (now mainstream) feature by name. * Apply suggestions from review --------- Co-authored-by: Mikey Lombardi (He/Him) --- .../About/about_Pipelines.md | 18 ++++++++---------- .../About/about_Pipelines.md | 18 ++++++++---------- .../About/about_Pipelines.md | 18 ++++++++---------- .../whats-new/What-s-New-in-PowerShell-74.md | 4 ++-- 4 files changed, 26 insertions(+), 32 deletions(-) diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Pipelines.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Pipelines.md index fb66f53c097e..75ad2ab87abe 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Pipelines.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Pipelines.md @@ -1,7 +1,7 @@ --- description: Combining commands into pipelines in the PowerShell Locale: en-US -ms.date: 10/02/2025 +ms.date: 12/28/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pipelines?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Pipelines @@ -400,17 +400,15 @@ one at a time. ## Using native commands in the pipeline PowerShell allows you to include native external commands in the pipeline. -However, it's important to note that PowerShell's pipeline is object-oriented -and doesn't support raw byte data. -Piping or redirecting output from a native program that outputs raw byte data -converts the output to .NET strings. This conversion can cause corruption of -the raw data output. +Before PowerShell 7.4, piping or redirecting output from a native program that +outputs raw byte data converted the output to .NET strings. This conversion +caused corruption of the raw data output. -However, PowerShell 7.4 added the `PSNativeCommandPreserveBytePipe` -experimental feature that preserves byte-stream data when redirecting the -**stdout** stream of a native command to a file or when piping byte-stream data -to the **stdin** stream of a native command. +In PowerShell 7.4 or higher, the `PSNativeCommandPreserveBytePipe` experimental +feature is mainstream. This feature preserves byte-stream data when +redirecting the **stdout** stream of a native command to a file or when piping +byte-stream data to the **stdin** stream of a native command. For example, using the native command `curl` you can download a binary file and save it to disk using redirection. diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Pipelines.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Pipelines.md index f4a6950b0c5d..2b1a48b94ee6 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Pipelines.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Pipelines.md @@ -1,7 +1,7 @@ --- description: Combining commands into pipelines in the PowerShell Locale: en-US -ms.date: 10/02/2025 +ms.date: 12/28/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pipelines?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Pipelines @@ -400,17 +400,15 @@ one at a time. ## Using native commands in the pipeline PowerShell allows you to include native external commands in the pipeline. -However, it's important to note that PowerShell's pipeline is object-oriented -and doesn't support raw byte data. -Piping or redirecting output from a native program that outputs raw byte data -converts the output to .NET strings. This conversion can cause corruption of -the raw data output. +Before PowerShell 7.4, piping or redirecting output from a native program that +outputs raw byte data converted the output to .NET strings. This conversion +caused corruption of the raw data output. -However, PowerShell 7.4 added the `PSNativeCommandPreserveBytePipe` -experimental feature that preserves byte-stream data when redirecting the -**stdout** stream of a native command to a file or when piping byte-stream data -to the **stdin** stream of a native command. +In PowerShell 7.4 or higher, the `PSNativeCommandPreserveBytePipe` experimental +feature is mainstream. This feature preserves byte-stream data when +redirecting the **stdout** stream of a native command to a file or when piping +byte-stream data to the **stdin** stream of a native command. For example, using the native command `curl` you can download a binary file and save it to disk using redirection. diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Pipelines.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Pipelines.md index 3b5ba1acf083..8dbe33db1254 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Pipelines.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Pipelines.md @@ -1,7 +1,7 @@ --- description: Combining commands into pipelines in the PowerShell Locale: en-US -ms.date: 10/02/2025 +ms.date: 12/28/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pipelines?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Pipelines @@ -400,17 +400,15 @@ one at a time. ## Using native commands in the pipeline PowerShell allows you to include native external commands in the pipeline. -However, it's important to note that PowerShell's pipeline is object-oriented -and doesn't support raw byte data. -Piping or redirecting output from a native program that outputs raw byte data -converts the output to .NET strings. This conversion can cause corruption of -the raw data output. +Before PowerShell 7.4, piping or redirecting output from a native program that +outputs raw byte data converted the output to .NET strings. This conversion +caused corruption of the raw data output. -However, PowerShell 7.4 added the `PSNativeCommandPreserveBytePipe` -experimental feature that preserves byte-stream data when redirecting the -**stdout** stream of a native command to a file or when piping byte-stream data -to the **stdin** stream of a native command. +In PowerShell 7.4 or higher, the `PSNativeCommandPreserveBytePipe` experimental +feature is mainstream. This feature preserves byte-stream data when +redirecting the **stdout** stream of a native command to a file or when piping +byte-stream data to the **stdin** stream of a native command. For example, using the native command `curl` you can download a binary file and save it to disk using redirection. diff --git a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-74.md b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-74.md index b03ff2ad2909..f89c2f4c4952 100644 --- a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-74.md +++ b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-74.md @@ -27,7 +27,7 @@ For a complete list of changes, see the [CHANGELOG][chg] in the GitHub repositor - Output from `Test-Connection` now includes more detailed information about TCP connection tests - .NET introduced changes that affected `Test-Connection`. The cmdlet now returns an error about the need to use `sudo` on Linux platforms when using a custom buffer size ([#20369][20369]) -- Experimental feature [PSNativeCommandPreserveBytePipe][10] is now mainstream. PowerShell now +- Experimental feature [PSNativeCommandPreserveBytePipe][11] is now mainstream. PowerShell now preserves the byte-stream data when redirecting the **stdout** stream of a native command to a file or when piping byte-stream data to the stdin stream of a native command. - Change how relative paths in `Resolve-Path` are handled when using the **RelativeBasePath** @@ -232,7 +232,7 @@ For more information about the Experimental Features, see [Using Experimental Fe [08]: /powershell/module/microsoft.powershell.core/about/about_ansi_terminals [09]: /powershell/module/microsoft.powershell.core/about/about_preference_variables#psnativecommandargumentpassing [10]: /powershell/module/microsoft.powershell.core/about/about_preference_variables#psnativecommanduseerroractionpreference -[11]: /powershell/module/microsoft.powershell.core/about/about_redirection?view=powershell-7.4&preserve-view=true#redirecting-output-from-native-commands +[11]: /powershell/module/microsoft.powershell.core/about/about_pipelines#using-native-commands-in-the-pipeline [12]: /powershell/module/microsoft.powershell.psresourceget [13]: /powershell/module/psreadline [14]: https://json-schema.org/understanding-json-schema/reference/schema From 6c4d0ff472452857738e2f3935722a6dcfc20cf0 Mon Sep 17 00:00:00 2001 From: surfingoldelephant <151538956+surfingoldelephant@users.noreply.github.com> Date: Fri, 2 Jan 2026 20:57:20 +0000 Subject: [PATCH 2/3] `.ps1xml` formatting file doc corrections (#12614) * Fix 5.1 about_Format.ps1xml examples This fixes the wrong path used in both `Update-FormatData` examples. The paths used to initially create the custom formatting files are .\MyDotNetTypes.Format.ps1xml and .\MyFileSystem.Format.ps1xml. Before this change, Update-FormatData -PrependPath incorrectly pointed to $HOME\Format\CultureInfo.Format.ps1xml and $PSHOME\Format\MyFileSystem.Format.ps1xml. * Use consistent paths in 7.x about_Format.ps1xml Both Update-FormatData examples now use the $HOME\Format example path. This also updates the first example to create the directory before calling Export-FormatData, as the directory doesn't exist by default and Export-FormatData fails if part of the path is missing. * Minor style changes * Specify the correct formatting file extension This fixes the incorrect assertion that formatting files **must** use `.format.ps1xml` (only `.ps1xml` is required). * Adjust formatting file signing note The original note suggests that after copying Win PS formatting files, the signature block should be replaced. However, the files don't actually contain a signature block to begin with. This may cause confusion, so the note is updated with a more generalized suggestion on signing taken from about_Format.ps1xml. Also includes minor style changes and less Windows-specific references. * Use the same example path in all doc versions The 7.x docs use `$HOME\Format` as an example directory. This updates the 5.1 doc to use the same path. It also removes the suggestion to place custom formatting files in Win PS's `$PSHOME`. As this is a system directory, it's not an appropriate location for user files. * Fix formatting * Fix link references * Fix link references again * Apply suggestions from review --------- Co-authored-by: Mikey Lombardi (He/Him) --- .../About/about_Format.ps1xml.md | 98 +++++++++++-------- .../About/about_Format.ps1xml.md | 15 +-- .../About/about_Format.ps1xml.md | 15 +-- .../About/about_Format.ps1xml.md | 15 +-- ...-create-a-formatting-file-format-ps1xml.md | 34 ++++--- 5 files changed, 103 insertions(+), 74 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md index 8e7518e6e313..ca996409bbef 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md @@ -1,7 +1,7 @@ --- description: The `Format.ps1xml` files in PowerShell define the default display of objects in the PowerShell console. You can create your own `Format.ps1xml` files to change the display of objects or to define default displays for new object types that you create in PowerShell. Locale: en-US -ms.date: 04/25/2022 +ms.date: 12/26/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_format.ps1xml?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Format.ps1xml @@ -88,7 +88,7 @@ headers, and the properties that are displayed in the body of the view. The format in `Format.ps1xml` files is applied just before the data is presented to the user. -## CREATING NEW FORMAT.PS1XML FILES +## Creating new Format.ps1xml files The `.ps1xml` files that are installed with PowerShell are digitally signed to prevent tampering because the formatting can include script blocks. To change @@ -98,9 +98,7 @@ session. To create a new file, copy an existing `Format.ps1xml` file. The new file can have any name, but it must have a `.ps1xml` file name extension. You can place -the new file in any directory that is accessible to PowerShell, but it's useful -to place the files in the PowerShell installation directory (`$PSHOME`) or in a -subdirectory of the installation directory. +the new file in any directory that is accessible to PowerShell. To change the formatting of a current view, locate the view in the formatting file, and then use the tags to change the view. To create a view for a new @@ -127,12 +125,11 @@ view of the culture objects. The following `Select-String` command finds the file: ```powershell -$Parms = @{ - Path = "$PSHOME\*Format.ps1xml" - Pattern = "System.Globalization.CultureInfo" +$selectParams = @{ + Path = "$PSHOME\*Format.ps1xml" + Pattern = 'System.Globalization.CultureInfo' } - -Select-String @Parms +Select-String @selectParams ``` ```Output @@ -142,14 +139,20 @@ C:\Windows\System32\WindowsPowerShell\v1.0\DotNetTypes.format.ps1xml:115: System.Globalization.CultureInfo ``` -This command reveals that the definition is in the `DotNetTypes.Format.ps1xml` +This command reveals that the definition is in the `DotNetTypes.format.ps1xml` file. -The next command copies the file contents to a new file, -`MyDotNetTypes.Format.ps1xml`. +The following commands copy the file contents to a new file named +`MyDotNetTypes.Format.ps1xml` in a newly created `$HOME\Format` directory. ```powershell -Copy-Item $PSHOME\DotNetTypes.format.ps1xml MyDotNetTypes.Format.ps1xml +New-Item -Path $HOME\Format -ItemType Directory -Force + +$copyParams = @{ + LiteralPath = "$PSHOME\DotNetTypes.format.ps1xml" + Destination = "$HOME\Format\MyDotNetTypes.Format.ps1xml" +} +Copy-Item @copyParams ``` Open the `MyDotNetTypes.Format.ps1xml` file in any XML or text editor, such as @@ -289,10 +292,10 @@ the current PowerShell session. This example uses the **PrependPath** parameter to place the new file in a higher precedence order than the original file. For more information, see -[Update-FormatData](xref:Microsoft.PowerShell.Utility.Update-FormatData). +[Update-FormatData][03]. ```powershell -Update-FormatData -PrependPath $HOME\Format\CultureInfo.Format.ps1xml +Update-FormatData -PrependPath $HOME\Format\MyDotNetTypes.Format.ps1xml ``` To test the change, type `Get-Culture` and review the output that includes the @@ -310,8 +313,8 @@ LCID Name Calendar DisplayName ## The XML in Format.ps1xml files -The full schema definition can be found in [Format.xsd](https://github.com/PowerShell/PowerShell/blob/master/src/Schemas/Format.xsd) -in the PowerShell source code repository on GitHub. +The full schema definition can be found in [Format.xsd][04] in the PowerShell +source code repository on GitHub. The **ViewDefinitions** section of each `Format.ps1xml` file contains the `` tags that define each view. A typical `` tag includes the @@ -376,13 +379,13 @@ that the `` tag is intended to display. ### WideControl tag The `` tag typically contains a `` tag. The -`` tag contains one or more `` tags. A `` tag -contains one `` tag. +`` tag contains one or more `` tags. A `` +tag contains one `` tag. A `` tag must include either a `` tag or a -`` tag. A `` tag specifies the property to display at -the specified location in the view. A `` tag specifies a script to -evaluate and display at the specified location in the view. +`` tag. A `` tag specifies the property to display +at the specified location in the view. A `` tag specifies a script +to evaluate and display at the specified location in the view. A `` tag can contain a `` tag that specifies how to display the property. @@ -396,7 +399,7 @@ multiple `` tags. Each `` tag contains a formatting of the specified location in the view, including ``, ``, ``, and `` tags. -## DEFAULT DISPLAYS IN TYPES.PS1XML +## Default displays in Types.ps1xml The default displays of some basic object types are defined in the `Types.ps1xml` file in the `$PSHOME` directory. The nodes are named @@ -417,15 +420,12 @@ value of the **Name** parameter: - FormatFileLoading - FormatViewBinding -For more information, see -[Trace-Command](xref:Microsoft.PowerShell.Utility.Trace-Command) and -[Get-TraceSource](xref:Microsoft.PowerShell.Utility.Get-TraceSource). +For more information, see [Trace-Command][05] and [Get-TraceSource][06]. ## Signing a Format.ps1xml file To protect the users of your `Format.ps1xml` file, sign the file using a -digital signature. For more information, see -[about_Signing](about_Signing.md). +digital signature. For more information, see [about_Signing][07]. ## Sample XML for a Format-Table custom view @@ -434,25 +434,38 @@ The following sample creates a `Format-Table` custom view for the `Get-ChildItem`. The custom view is named **MyGciView** and adds the **CreationTime** column to the table. +Use `Select-String` to identify which `Format.ps1xml` file contains data for +the type you're looking for. + The custom view is created from an edited version of the `FileSystem.Format.ps1xml` file that's stored in `$PSHOME` on PowerShell 5.1. -After your custom `.ps1xml` file is saved, use `Update-FormatData` to include -the view in a PowerShell session. For this example, the custom view must use -the table format, otherwise, `Format-Table` fails. +After the custom `.ps1xml` file is saved, use the `Update-FormatData` cmdlet to +include the view in the current PowerShell session. Or, add the update command +to your PowerShell profile if you need the view available in all PowerShell +sessions. + +For this example, the custom view must use the table format, otherwise, +`Format-Table` fails. Use `Format-Table` with the **View** parameter to specify the custom view's -name and format the table's output. For an example of how the command is run, -see [Format-Table](xref:Microsoft.PowerShell.Utility.Format-Table). +name, **MyGciView**, and format the table's output with the **CreationTime** +column. For an example of how the command is run, see [Format-Table][08]. ```powershell -$Parms = @{ - Path = "$PSHOME\*Format.ps1xml" - Pattern = "System.IO.DirectoryInfo" +$selectParams = @{ + Path = "$PSHOME\*format.ps1xml" + Pattern = 'System.IO.DirectoryInfo' } -Select-String @Parms -Copy-Item $PSHOME\FileSystem.format.ps1xml .\MyFileSystem.Format.ps1xml -Update-FormatData -PrependPath $PSHOME\Format\MyFileSystem.Format.ps1xml +Select-String @selectParams + +$copyParams = @{ + LiteralPath = "$PSHOME\FileSystem.format.ps1xml" + Destination = "$HOME\Format\MyFileSystem.Format.ps1xml" +} +Copy-Item @copyParams + +Update-FormatData -PrependPath $HOME\Format\MyFileSystem.Format.ps1xml ``` > [!NOTE] @@ -582,9 +595,10 @@ Update-FormatData -PrependPath $PSHOME\Format\MyFileSystem.Format.ps1xml [01]: xref:Microsoft.PowerShell.Utility.Get-FormatData [02]: xref:Microsoft.PowerShell.Utility.Export-FormatData [03]: xref:Microsoft.PowerShell.Utility.Update-FormatData - +[04]: https://github.com/PowerShell/PowerShell/blob/master/src/Schemas/Format.xsd [05]: xref:Microsoft.PowerShell.Utility.Trace-Command [06]: xref:Microsoft.PowerShell.Utility.Get-TraceSource - +[07]: about_Signing.md +[08]: xref:Microsoft.PowerShell.Utility.Format-Table [09]: /powershell/scripting/developer/format/format-schema-xml-reference [10]: /powershell/scripting/developer/format/writing-a-powershell-formatting-file diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md index 64ca92f95698..e4d49cef93ed 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md @@ -1,7 +1,7 @@ --- description: Beginning in PowerShell 6, the default views for objects are defined in PowerShell source code. You can create your own `Format.ps1xml` files to change the display of objects or to define default displays for new object types that you create in PowerShell. Locale: en-US -ms.date: 04/25/2022 +ms.date: 12/26/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_format.ps1xml?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Format.ps1xml @@ -93,8 +93,10 @@ To begin, get the format data from the source code file and create a `Format.ps1xml` file that contains the current view of the culture objects. ```powershell +New-Item -Path $HOME\Format -ItemType Directory -Force + Get-FormatData -TypeName System.Globalization.CultureInfo | - Export-FormatData -Path $HOME\Format\CultureInfo.Format.ps1xml + Export-FormatData -LiteralPath $HOME\Format\CultureInfo.Format.ps1xml ``` Open the `CultureInfo.Format.ps1xml` file in any XML or text editor, such as @@ -278,8 +280,8 @@ that the `` tag is intended to display. ### WideControl tag The `` tag typically contains a `` tag. The -`` tag contains one or more `` tags. A `` tag -contains one `` tag. +`` tag contains one or more `` tags. A `` +tag contains one `` tag. A `` tag must include either a `` tag or a `` tag. A `` tag specifies the property to display @@ -349,8 +351,9 @@ specific PowerShell version. ```powershell Get-FormatData -PowerShellVersion 5.1 -TypeName System.IO.DirectoryInfo | - Export-FormatData -Path ./MyGciView.Format.ps1xml -Update-FormatData -AppendPath ./MyGciView.Format.ps1xml + Export-FormatData -LiteralPath $HOME\Format\MyGciView.Format.ps1xml + +Update-FormatData -AppendPath $HOME\Format\MyGciView.Format.ps1xml ``` ```xml diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md index d74b9d8de1c1..ff09056394e1 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md @@ -1,7 +1,7 @@ --- description: Beginning in PowerShell 6, the default views for objects are defined in PowerShell source code. You can create your own `Format.ps1xml` files to change the display of objects or to define default displays for new object types that you create in PowerShell. Locale: en-US -ms.date: 04/25/2022 +ms.date: 12/26/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_format.ps1xml?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Format.ps1xml @@ -93,8 +93,10 @@ To begin, get the format data from the source code file and create a `Format.ps1xml` file that contains the current view of the culture objects. ```powershell +New-Item -Path $HOME\Format -ItemType Directory -Force + Get-FormatData -TypeName System.Globalization.CultureInfo | - Export-FormatData -Path $HOME\Format\CultureInfo.Format.ps1xml + Export-FormatData -LiteralPath $HOME\Format\CultureInfo.Format.ps1xml ``` Open the `CultureInfo.Format.ps1xml` file in any XML or text editor, such as @@ -278,8 +280,8 @@ that the `` tag is intended to display. ### WideControl tag The `` tag typically contains a `` tag. The -`` tag contains one or more `` tags. A `` tag -contains one `` tag. +`` tag contains one or more `` tags. A `` +tag contains one `` tag. A `` tag must include either a `` tag or a `` tag. A `` tag specifies the property to display @@ -349,8 +351,9 @@ specific PowerShell version. ```powershell Get-FormatData -PowerShellVersion 5.1 -TypeName System.IO.DirectoryInfo | - Export-FormatData -Path ./MyGciView.Format.ps1xml -Update-FormatData -AppendPath ./MyGciView.Format.ps1xml + Export-FormatData -Path $HOME\Format\MyGciView.Format.ps1xml + +Update-FormatData -AppendPath $HOME\Format\MyGciView.Format.ps1xml ``` ```xml diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md index 6d6db494c8f3..b8cefcf7a508 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md @@ -1,7 +1,7 @@ --- description: Beginning in PowerShell 6, the default views for objects are defined in PowerShell source code. You can create your own `Format.ps1xml` files to change the display of objects or to define default displays for new object types that you create in PowerShell. Locale: en-US -ms.date: 04/25/2022 +ms.date: 12/26/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_format.ps1xml?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Format.ps1xml @@ -93,8 +93,10 @@ To begin, get the format data from the source code file and create a `Format.ps1xml` file that contains the current view of the culture objects. ```powershell +New-Item -Path $HOME\Format -ItemType Directory -Force + Get-FormatData -TypeName System.Globalization.CultureInfo | - Export-FormatData -Path $HOME\Format\CultureInfo.Format.ps1xml + Export-FormatData -LiteralPath $HOME\Format\CultureInfo.Format.ps1xml ``` Open the `CultureInfo.Format.ps1xml` file in any XML or text editor, such as @@ -278,8 +280,8 @@ that the `` tag is intended to display. ### WideControl tag The `` tag typically contains a `` tag. The -`` tag contains one or more `` tags. A `` tag -contains one `` tag. +`` tag contains one or more `` tags. A `` +tag contains one `` tag. A `` tag must include either a `` tag or a `` tag. A `` tag specifies the property to display @@ -349,8 +351,9 @@ specific PowerShell version. ```powershell Get-FormatData -PowerShellVersion 5.1 -TypeName System.IO.DirectoryInfo | - Export-FormatData -Path ./MyGciView.Format.ps1xml -Update-FormatData -AppendPath ./MyGciView.Format.ps1xml + Export-FormatData -Path $HOME\Format\MyGciView.Format.ps1xml + +Update-FormatData -AppendPath $HOME\Format\MyGciView.Format.ps1xml ``` ```xml diff --git a/reference/docs-conceptual/developer/format/how-to-create-a-formatting-file-format-ps1xml.md b/reference/docs-conceptual/developer/format/how-to-create-a-formatting-file-format-ps1xml.md index a41ec614682a..4348a6f1d239 100644 --- a/reference/docs-conceptual/developer/format/how-to-create-a-formatting-file-format-ps1xml.md +++ b/reference/docs-conceptual/developer/format/how-to-create-a-formatting-file-format-ps1xml.md @@ -1,25 +1,25 @@ --- -description: How to Create a Formatting File (.format.ps1xml) -ms.date: 08/23/2021 -title: How to Create a Formatting File (.format.ps1xml) +description: How to Create a Formatting File (Format.ps1xml) +ms.date: 12/26/2025 +title: How to Create a Formatting File (Format.ps1xml) --- -# How to Create a Formatting File (.format.ps1xml) +# How to Create a Formatting File (Format.ps1xml) -This topic describes how to create a formatting file (.format.ps1xml). +This topic describes how to create a formatting file (`Format.ps1xml`). > [!NOTE] > You can also create a formatting file by making a copy of one of the files provided by Windows -> PowerShell. If you make a copy of an existing file, delete the existing digital signature, and add -> your own signature to the new file. +> PowerShell. To protect the users of your `Format.ps1xml` file, sign the file using a digital +> signature. For more information, see [about_Signing][01]. -## Create a .format.ps1xml file. +## Create a Format.ps1xml file -1. Create a text file (.txt) using a text editor such as Notepad. +1. Open a new text file using a text editor such as Visual Studio Code. 1. Copy the following lines into the formatting file. ```xml - + @@ -32,14 +32,20 @@ This topic describes how to create a formatting file (.format.ps1xml). - The `` tags define the `ViewDefinitions` node. All views are defined within this node. -1. Save the file to the Windows PowerShell installation folder, to your module folder, or to a +1. Save the file to a folder of your choice. If you are writing a module, save the file to a subfolder of the module folder. Use the following name format when you save the file: - `MyFile.format.ps1xml`. Formatting files must use the `.format.ps1xml` extension. + `MyFile.Format.ps1xml`. Formatting files must use the `.ps1xml` extension. You are now ready to add views to the formatting file. There is no limit to the number of views that can be defined in a formatting file. You can add a single view for each object, multiple views for the same object, or a single view that is used by multiple objects. -## See Also +## See also -[Writing a Windows PowerShell Formatting and Types File](./writing-a-powershell-formatting-file.md) +- [Formatting File Overview][02] +- [Formatting File Concepts][03] + + +[01]: /powershell/module/microsoft.powershell.core/about/about_signing +[02]: ./formatting-file-overview.md +[03]: ./formatting-file-concepts.md From 0a55ed6e7bd6ec3fdac0c42bdefb61298a4dddd1 Mon Sep 17 00:00:00 2001 From: surfingoldelephant <151538956+surfingoldelephant@users.noreply.github.com> Date: Fri, 2 Jan 2026 21:10:48 +0000 Subject: [PATCH 3/3] Update CSV cmdlet `-Delimiter` parameter description (#12617) * Update CSV cmdlet -Delimiter param description This clarifies the deserialization behavior when the specified delimiter doesn't match the actual delimiter in the input data. Before this change, the verbiage for Import/ConvertFrom-Csv implied one or more strings would be returned, which isn't the case. This also adds the existing note regarding escaped special characters to all docs. Previously, this was only present in Import-Csv docs, but is applicable to/useful for all CSV cmdlets. * Apply suggestions from review --------- Co-authored-by: Mikey Lombardi (He/Him) --- .../ConvertFrom-Csv.md | 20 ++++++--- .../ConvertTo-Csv.md | 8 +++- .../Export-Csv.md | 44 ++++++++++++------- .../Import-Csv.md | 15 ++++--- .../ConvertFrom-Csv.md | 20 ++++++--- .../ConvertTo-Csv.md | 8 +++- .../Export-Csv.md | 44 ++++++++++++------- .../Import-Csv.md | 15 ++++--- .../ConvertFrom-Csv.md | 20 ++++++--- .../ConvertTo-Csv.md | 8 +++- .../Export-Csv.md | 10 +++-- .../Import-Csv.md | 15 ++++--- .../ConvertFrom-Csv.md | 20 ++++++--- .../ConvertTo-Csv.md | 8 +++- .../Export-Csv.md | 25 ++++++++--- .../Import-Csv.md | 15 ++++--- 16 files changed, 193 insertions(+), 102 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md b/reference/5.1/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md index 20df4fd57db3..440cd3aaa960 100644 --- a/reference/5.1/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md +++ b/reference/5.1/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 11/18/2025 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/convertfrom-csv?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: ConvertFrom-Csv @@ -10,6 +10,7 @@ title: ConvertFrom-Csv # ConvertFrom-Csv ## SYNOPSIS + Converts object properties in character-separated value (CSV) format into CSV versions of the original objects. @@ -145,7 +146,7 @@ the **InputObject** parameter and converts the CSV strings from the `$Services` When the **UseCulture** parameter is used, be sure that the current culture's default list separator matches the delimiter used in the CSV strings. Otherwise, `ConvertFrom-Csv` can't -generate objects from the CSV strings. +can't parse each column into distinct properties. ### Example 5: Convert CSV data in W3C Extended Log Format @@ -176,12 +177,17 @@ time cs-method cs-uri ### -Delimiter -Specifies the delimiter that separates the property values in the CSV strings. The default is a -comma (`,`). Enter a character, such as a colon (`:`). To specify a semicolon (`;`) enclose it in -single quotation marks. +Specifies the delimiter that separates the property values in the CSV data. The default is a comma +(`,`). + +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single +quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double +quotation marks. -If you specify a character other than the actual string delimiter in the file, `ConvertFrom-Csv` -can't create the objects from the CSV strings and returns the CSV strings. +If the specified character doesn't match the actual delimiter in the CSV data, `ConvertFrom-Csv` +can't parse each column into distinct properties. In this case, it outputs one **PSCustomObject** +per row, each containing a single property whose name is the full header and whose value is the row +text. ```yaml Type: System.Char diff --git a/reference/5.1/Microsoft.PowerShell.Utility/ConvertTo-Csv.md b/reference/5.1/Microsoft.PowerShell.Utility/ConvertTo-Csv.md index 5b07a9678a99..943f69636dfa 100644 --- a/reference/5.1/Microsoft.PowerShell.Utility/ConvertTo-Csv.md +++ b/reference/5.1/Microsoft.PowerShell.Utility/ConvertTo-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 03/14/2023 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/convertto-csv?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: ConvertTo-Csv @@ -11,6 +11,7 @@ title: ConvertTo-Csv # ConvertTo-Csv ## SYNOPSIS + Converts .NET objects into a series of character-separated value (CSV) strings. ## SYNTAX @@ -109,7 +110,10 @@ information header from the CSV output. ### -Delimiter Specifies the delimiter to separate the property values in CSV strings. The default is a comma -(`,`). Enter a character, such as a colon (`:`). To specify a semicolon (`;`) enclose it in single +(`,`). + +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single +quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double quotation marks. ```yaml diff --git a/reference/5.1/Microsoft.PowerShell.Utility/Export-Csv.md b/reference/5.1/Microsoft.PowerShell.Utility/Export-Csv.md index 2b566898a32e..29cdca820654 100644 --- a/reference/5.1/Microsoft.PowerShell.Utility/Export-Csv.md +++ b/reference/5.1/Microsoft.PowerShell.Utility/Export-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 03/14/2023 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/export-csv?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 aliases: @@ -13,6 +13,7 @@ title: Export-Csv # Export-Csv ## SYNOPSIS + Converts objects into a series of character-separated value (CSV) strings and saves the strings to a file. @@ -142,11 +143,12 @@ Get-Content -Path .\Processes.csv The `Get-Culture` cmdlet uses the nested properties **TextInfo** and **ListSeparator** and displays the current culture's default list separator. The `Get-Process` cmdlet gets **Process** objects. The process objects are sent down the pipeline to the `Export-Csv` cmdlet. `Export-Csv` converts the -process objects to a series of CSV strings. The **Path** parameter specifies that the `Processes.csv` -file is saved in the current directory. The **UseCulture** parameter uses the current culture's -default list separator as the delimiter. The **NoTypeInformation** parameter removes the **#TYPE** -information header from the CSV output and is not required in PowerShell 6. The `Get-Content` cmdlet -uses the **Path** parameter to display the file located in the current directory. +process objects to a series of CSV strings. The **Path** parameter specifies that the +`Processes.csv` file is saved in the current directory. The **UseCulture** parameter uses the +current culture's default list separator as the delimiter. The **NoTypeInformation** parameter +removes the **#TYPE** information header from the CSV output and is not required in PowerShell 6. +The `Get-Content` cmdlet uses the **Path** parameter to display the file located in the current +directory. ### Example 5: Export processes with type information @@ -176,10 +178,15 @@ This example describes how to export objects to a CSV file and use the **Append* objects to an existing file. ```powershell -$AppService = (Get-Service -DisplayName *Application* | Select-Object -Property DisplayName, Status) +$AppService = Get-Service -DisplayName *Application* | + Select-Object -Property DisplayName, Status + $AppService | Export-Csv -Path .\Services.Csv -NoTypeInformation Get-Content -Path .\Services.Csv -$WinService = (Get-Service -DisplayName *Windows* | Select-Object -Property DisplayName, Status) + +$WinService = Get-Service -DisplayName *Windows* | + Select-Object -Property DisplayName, Status + $WinService | Export-Csv -Path .\Services.csv -NoTypeInformation -Append Get-Content -Path .\Services.Csv ``` @@ -218,7 +225,8 @@ unexpected output is received, troubleshoot the pipeline syntax. ```powershell Get-Date | Select-Object -Property DateTime, Day, DayOfWeek, DayOfYear | - Export-Csv -Path .\DateTime.csv -NoTypeInformation + Export-Csv -Path .\DateTime.csv -NoTypeInformation + Get-Content -Path .\DateTime.csv ``` @@ -229,7 +237,8 @@ Get-Content -Path .\DateTime.csv ```powershell Get-Date | Format-Table -Property DateTime, Day, DayOfWeek, DayOfYear | - Export-Csv -Path .\FTDateTime.csv -NoTypeInformation + Export-Csv -Path .\FTDateTime.csv -NoTypeInformation + Get-Content -Path .\FTDateTime.csv ``` @@ -245,10 +254,10 @@ Get-Content -Path .\FTDateTime.csv The `Get-Date` cmdlet gets the **DateTime** object. The object is sent down the pipeline to the `Select-Object` cmdlet. `Select-Object` uses the **Property** parameter to select a subset of object properties. The object is sent down the pipeline to the `Export-Csv` cmdlet. `Export-Csv` converts -the object to a CSV format. The **Path** parameter specifies that the `DateTime.csv` file is saved in -the current directory. The **NoTypeInformation** parameter removes the **#TYPE** information header -from the CSV output and is not required in PowerShell 6. The `Get-Content` cmdlet uses the **Path** -parameter to display the CSV file located in the current directory. +the object to a CSV format. The **Path** parameter specifies that the `DateTime.csv` file is saved +in the current directory. The **NoTypeInformation** parameter removes the **#TYPE** information +header from the CSV output and is not required in PowerShell 6. The `Get-Content` cmdlet uses the +**Path** parameter to display the CSV file located in the current directory. When the `Format-Table` cmdlet is used within the pipeline to select properties unexpected results are received. `Format-Table` sends table format objects down the pipeline to the `Export-Csv` cmdlet @@ -372,8 +381,11 @@ Accept wildcard characters: False ### -Delimiter -Specifies a delimiter to separate the property values. The default is a comma (`,`). Enter a -character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in quotation marks. +Specifies a delimiter to separate the property values. The default is a comma (`,`). + +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single +quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double +quotation marks. ```yaml Type: System.Char diff --git a/reference/5.1/Microsoft.PowerShell.Utility/Import-Csv.md b/reference/5.1/Microsoft.PowerShell.Utility/Import-Csv.md index 0866ffe354fe..55dfdfaf5ac7 100644 --- a/reference/5.1/Microsoft.PowerShell.Utility/Import-Csv.md +++ b/reference/5.1/Microsoft.PowerShell.Utility/Import-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 01/09/2025 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/import-csv?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 aliases: @@ -13,6 +13,7 @@ title: Import-Csv # Import-Csv ## SYNOPSIS + Creates table-like custom objects from the items in a character-separated value (CSV) file. ## SYNTAX @@ -271,8 +272,8 @@ Import-Csv -Path .\Projects.csv ``` ```Output -WARNING: One or more headers weren't specified. Default names starting with "H" have been used in -place of any missing headers. +WARNING: One or more headers weren't specified. Default names starting with "H" have been +used in place of any missing headers. ProjectID ProjectName H1 Completed --------- ----------- -- --------- @@ -292,12 +293,14 @@ displays a warning message because **H1** is a default header name. Specifies the delimiter that separates the property values in the CSV file. The default is a comma (`,`). -Enter a character, such as a colon (`:`). To specify a semicolon (`;`) enclose it in single +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double quotation marks. -If you specify a character other than the actual string delimiter in the file, `Import-Csv` can't -create the objects from the CSV strings and returns the full CSV strings. +If the specified character doesn't match the actual delimiter in the CSV data, `Import-Csv` can't +parse each column into distinct properties. In this case, it outputs one **PSCustomObject** per +row, each containing a single property whose name is the full header and whose value is the row +text. ```yaml Type: System.Char diff --git a/reference/7.4/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md b/reference/7.4/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md index 6980ee05592c..7032af9335ce 100644 --- a/reference/7.4/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md +++ b/reference/7.4/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 11/18/2025 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/convertfrom-csv?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: ConvertFrom-Csv @@ -10,6 +10,7 @@ title: ConvertFrom-Csv # ConvertFrom-Csv ## SYNOPSIS + Converts object properties in character-separated value (CSV) format into CSV versions of the original objects. @@ -145,7 +146,7 @@ the **InputObject** parameter and converts the CSV strings from the `$Services` When the **UseCulture** parameter is used, be sure that the current culture's default list separator matches the delimiter used in the CSV strings. Otherwise, `ConvertFrom-Csv` can't -generate objects from the CSV strings. +can't parse each column into distinct properties. ### Example 5: Convert CSV data in W3C Extended Log Format @@ -177,12 +178,17 @@ time cs-method cs-uri ### -Delimiter -Specifies the delimiter that separates the property values in the CSV strings. The default is a -comma (`,`). Enter a character, such as a colon (`:`). To specify a semicolon (`;`) enclose it in -single quotation marks. +Specifies the delimiter that separates the property values in the CSV data. The default is a comma +(`,`). + +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single +quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double +quotation marks. -If you specify a character other than the actual string delimiter in the file, `ConvertFrom-Csv` -can't create the objects from the CSV strings and returns the CSV strings. +If the specified character doesn't match the actual delimiter in the CSV data, `ConvertFrom-Csv` +can't parse each column into distinct properties. In this case, it outputs one **PSCustomObject** +per row, each containing a single property whose name is the full header and whose value is the row +text. ```yaml Type: System.Char diff --git a/reference/7.4/Microsoft.PowerShell.Utility/ConvertTo-Csv.md b/reference/7.4/Microsoft.PowerShell.Utility/ConvertTo-Csv.md index 24b44cf2fe54..08c91d2de45a 100644 --- a/reference/7.4/Microsoft.PowerShell.Utility/ConvertTo-Csv.md +++ b/reference/7.4/Microsoft.PowerShell.Utility/ConvertTo-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 03/14/2023 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/convertto-csv?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: ConvertTo-Csv @@ -11,6 +11,7 @@ title: ConvertTo-Csv # ConvertTo-Csv ## SYNOPSIS + Converts .NET objects into a series of character-separated value (CSV) strings. ## SYNTAX @@ -186,7 +187,10 @@ only the key is converted to CSV. ### -Delimiter Specifies the delimiter to separate the property values in CSV strings. The default is a comma -(`,`). Enter a character, such as a colon (`:`). To specify a semicolon (`;`) enclose it in single +(`,`). + +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single +quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double quotation marks. ```yaml diff --git a/reference/7.4/Microsoft.PowerShell.Utility/Export-Csv.md b/reference/7.4/Microsoft.PowerShell.Utility/Export-Csv.md index b62fbaea6ced..d102d002f31c 100644 --- a/reference/7.4/Microsoft.PowerShell.Utility/Export-Csv.md +++ b/reference/7.4/Microsoft.PowerShell.Utility/Export-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 03/15/2023 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/export-csv?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 aliases: @@ -13,6 +13,7 @@ title: Export-Csv # Export-Csv ## SYNOPSIS + Converts objects into a series of character-separated value (CSV) strings and saves the strings to a file. @@ -144,11 +145,12 @@ Get-Content -Path .\Processes.csv The `Get-Culture` cmdlet uses the nested properties **TextInfo** and **ListSeparator** and displays the current culture's default list separator. The `Get-Process` cmdlet gets **Process** objects. The process objects are sent down the pipeline to the `Export-Csv` cmdlet. `Export-Csv` converts the -process objects to a series of CSV strings. The **Path** parameter specifies that the `Processes.csv` -file is saved in the current directory. The **UseCulture** parameter uses the current culture's -default list separator as the delimiter. The **NoTypeInformation** parameter removes the **#TYPE** -information header from the CSV output and is not required in PowerShell 6. The `Get-Content` cmdlet -uses the **Path** parameter to display the file located in the current directory. +process objects to a series of CSV strings. The **Path** parameter specifies that the +`Processes.csv` file is saved in the current directory. The **UseCulture** parameter uses the +current culture's default list separator as the delimiter. The **NoTypeInformation** parameter +removes the **#TYPE** information header from the CSV output and is not required in PowerShell 6. +The `Get-Content` cmdlet uses the **Path** parameter to display the file located in the current +directory. ### Example 5: Export processes with type information @@ -179,10 +181,15 @@ This example describes how to export objects to a CSV file and use the **Append* objects to an existing file. ```powershell -$AppService = (Get-Service -DisplayName *Application* | Select-Object -Property DisplayName, Status) +$AppService = Get-Service -DisplayName *Application* | + Select-Object -Property DisplayName, Status + $AppService | Export-Csv -Path .\Services.Csv -NoTypeInformation Get-Content -Path .\Services.Csv -$WinService = (Get-Service -DisplayName *Windows* | Select-Object -Property DisplayName, Status) + +$WinService = Get-Service -DisplayName *Windows* | + Select-Object -Property DisplayName, Status + $WinService | Export-Csv -Path .\Services.csv -NoTypeInformation -Append Get-Content -Path .\Services.Csv ``` @@ -221,7 +228,8 @@ unexpected output is received, troubleshoot the pipeline syntax. ```powershell Get-Date | Select-Object -Property DateTime, Day, DayOfWeek, DayOfYear | - Export-Csv -Path .\DateTime.csv -NoTypeInformation + Export-Csv -Path .\DateTime.csv -NoTypeInformation + Get-Content -Path .\DateTime.csv ``` @@ -232,7 +240,8 @@ Get-Content -Path .\DateTime.csv ```powershell Get-Date | Format-Table -Property DateTime, Day, DayOfWeek, DayOfYear | - Export-Csv -Path .\FTDateTime.csv -NoTypeInformation + Export-Csv -Path .\FTDateTime.csv -NoTypeInformation + Get-Content -Path .\FTDateTime.csv ``` @@ -248,10 +257,10 @@ Get-Content -Path .\FTDateTime.csv The `Get-Date` cmdlet gets the **DateTime** object. The object is sent down the pipeline to the `Select-Object` cmdlet. `Select-Object` uses the **Property** parameter to select a subset of object properties. The object is sent down the pipeline to the `Export-Csv` cmdlet. `Export-Csv` converts -the object to a CSV format. The **Path** parameter specifies that the `DateTime.csv` file is saved in -the current directory. The **NoTypeInformation** parameter removes the **#TYPE** information header -from the CSV output and is not required in PowerShell 6. The `Get-Content` cmdlet uses the **Path** -parameter to display the CSV file located in the current directory. +the object to a CSV format. The **Path** parameter specifies that the `DateTime.csv` file is saved +in the current directory. The **NoTypeInformation** parameter removes the **#TYPE** information +header from the CSV output and is not required in PowerShell 6. The `Get-Content` cmdlet uses the +**Path** parameter to display the CSV file located in the current directory. When the `Format-Table` cmdlet is used within the pipeline to select properties unexpected results are received. `Format-Table` sends table format objects down the pipeline to the `Export-Csv` cmdlet @@ -456,8 +465,11 @@ Accept wildcard characters: False ### -Delimiter -Specifies a delimiter to separate the property values. The default is a comma (`,`). Enter a -character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in quotation marks. +Specifies a delimiter to separate the property values. The default is a comma (`,`). + +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single +quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double +quotation marks. ```yaml Type: System.Char diff --git a/reference/7.4/Microsoft.PowerShell.Utility/Import-Csv.md b/reference/7.4/Microsoft.PowerShell.Utility/Import-Csv.md index a65d9de00161..451f034bf86d 100644 --- a/reference/7.4/Microsoft.PowerShell.Utility/Import-Csv.md +++ b/reference/7.4/Microsoft.PowerShell.Utility/Import-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 01/09/2025 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/import-csv?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 aliases: @@ -13,6 +13,7 @@ title: Import-Csv # Import-Csv ## SYNOPSIS + Creates table-like custom objects from the items in a character-separated value (CSV) file. ## SYNTAX @@ -284,8 +285,8 @@ Import-Csv -Path .\Projects.csv ``` ```Output -WARNING: One or more headers weren't specified. Default names starting with "H" have been used in -place of any missing headers. +WARNING: One or more headers weren't specified. Default names starting with "H" have been +used in place of any missing headers. ProjectID ProjectName H1 Completed --------- ----------- -- --------- @@ -305,12 +306,14 @@ displays a warning message because **H1** is a default header name. Specifies the delimiter that separates the property values in the CSV file. The default is a comma (`,`). -Enter a character, such as a colon (`:`). To specify a semicolon (`;`) enclose it in single +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double quotation marks. -If you specify a character other than the actual string delimiter in the file, `Import-Csv` can't -create the objects from the CSV strings and returns the full CSV strings. +If the specified character doesn't match the actual delimiter in the CSV data, `Import-Csv` can't +parse each column into distinct properties. In this case, it outputs one **PSCustomObject** per +row, each containing a single property whose name is the full header and whose value is the row +text. ```yaml Type: System.Char diff --git a/reference/7.5/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md b/reference/7.5/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md index ad1d86c5b7d1..82bab5b3cbb0 100644 --- a/reference/7.5/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md +++ b/reference/7.5/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 11/18/2025 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/convertfrom-csv?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: ConvertFrom-Csv @@ -10,6 +10,7 @@ title: ConvertFrom-Csv # ConvertFrom-Csv ## SYNOPSIS + Converts object properties in character-separated value (CSV) format into CSV versions of the original objects. @@ -145,7 +146,7 @@ the **InputObject** parameter and converts the CSV strings from the `$Services` When the **UseCulture** parameter is used, be sure that the current culture's default list separator matches the delimiter used in the CSV strings. Otherwise, `ConvertFrom-Csv` can't -generate objects from the CSV strings. +can't parse each column into distinct properties. ### Example 5: Convert CSV data in W3C Extended Log Format @@ -177,12 +178,17 @@ time cs-method cs-uri ### -Delimiter -Specifies the delimiter that separates the property values in the CSV strings. The default is a -comma (`,`). Enter a character, such as a colon (`:`). To specify a semicolon (`;`) enclose it in -single quotation marks. +Specifies the delimiter that separates the property values in the CSV data. The default is a comma +(`,`). + +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single +quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double +quotation marks. -If you specify a character other than the actual string delimiter in the file, `ConvertFrom-Csv` -can't create the objects from the CSV strings and returns the CSV strings. +If the specified character doesn't match the actual delimiter in the CSV data, `ConvertFrom-Csv` +can't parse each column into distinct properties. In this case, it outputs one **PSCustomObject** +per row, each containing a single property whose name is the full header and whose value is the row +text. ```yaml Type: System.Char diff --git a/reference/7.5/Microsoft.PowerShell.Utility/ConvertTo-Csv.md b/reference/7.5/Microsoft.PowerShell.Utility/ConvertTo-Csv.md index 461b9497ef61..6680c935b611 100644 --- a/reference/7.5/Microsoft.PowerShell.Utility/ConvertTo-Csv.md +++ b/reference/7.5/Microsoft.PowerShell.Utility/ConvertTo-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 03/14/2023 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/convertto-csv?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: ConvertTo-Csv @@ -11,6 +11,7 @@ title: ConvertTo-Csv # ConvertTo-Csv ## SYNOPSIS + Converts .NET objects into a series of character-separated value (CSV) strings. ## SYNTAX @@ -188,7 +189,10 @@ only the key is converted to CSV. ### -Delimiter Specifies the delimiter to separate the property values in CSV strings. The default is a comma -(`,`). Enter a character, such as a colon (`:`). To specify a semicolon (`;`) enclose it in single +(`,`). + +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single +quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double quotation marks. ```yaml diff --git a/reference/7.5/Microsoft.PowerShell.Utility/Export-Csv.md b/reference/7.5/Microsoft.PowerShell.Utility/Export-Csv.md index 0e5f58fddaba..9482644e2f3f 100644 --- a/reference/7.5/Microsoft.PowerShell.Utility/Export-Csv.md +++ b/reference/7.5/Microsoft.PowerShell.Utility/Export-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 03/15/2023 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/export-csv?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 aliases: @@ -13,6 +13,7 @@ title: Export-Csv # Export-Csv ## SYNOPSIS + Converts objects into a series of character-separated value (CSV) strings and saves the strings to a file. @@ -460,8 +461,11 @@ Accept wildcard characters: False ### -Delimiter -Specifies a delimiter to separate the property values. The default is a comma (`,`). Enter a -character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in quotation marks. +Specifies a delimiter to separate the property values. The default is a comma (`,`). + +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single +quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double +quotation marks. ```yaml Type: System.Char diff --git a/reference/7.5/Microsoft.PowerShell.Utility/Import-Csv.md b/reference/7.5/Microsoft.PowerShell.Utility/Import-Csv.md index 3af35608f0f0..5d2e0f19caee 100644 --- a/reference/7.5/Microsoft.PowerShell.Utility/Import-Csv.md +++ b/reference/7.5/Microsoft.PowerShell.Utility/Import-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 01/09/2025 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/import-csv?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 aliases: @@ -13,6 +13,7 @@ title: Import-Csv # Import-Csv ## SYNOPSIS + Creates table-like custom objects from the items in a character-separated value (CSV) file. ## SYNTAX @@ -284,8 +285,8 @@ Import-Csv -Path .\Projects.csv ``` ```Output -WARNING: One or more headers weren't specified. Default names starting with "H" have been used in -place of any missing headers. +WARNING: One or more headers weren't specified. Default names starting with "H" have been +used in place of any missing headers. ProjectID ProjectName H1 Completed --------- ----------- -- --------- @@ -305,12 +306,14 @@ displays a warning message because **H1** is a default header name. Specifies the delimiter that separates the property values in the CSV file. The default is a comma (`,`). -Enter a character, such as a colon (`:`). To specify a semicolon (`;`) enclose it in single +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double quotation marks. -If you specify a character other than the actual string delimiter in the file, `Import-Csv` can't -create the objects from the CSV strings and returns the full CSV strings. +If the specified character doesn't match the actual delimiter in the CSV data, `Import-Csv` can't +parse each column into distinct properties. In this case, it outputs one **PSCustomObject** per +row, each containing a single property whose name is the full header and whose value is the row +text. ```yaml Type: System.Char diff --git a/reference/7.6/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md b/reference/7.6/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md index b8e0ee377713..fcb9eee839bd 100644 --- a/reference/7.6/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md +++ b/reference/7.6/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 11/18/2025 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/convertfrom-csv?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: ConvertFrom-Csv @@ -10,6 +10,7 @@ title: ConvertFrom-Csv # ConvertFrom-Csv ## SYNOPSIS + Converts object properties in character-separated value (CSV) format into CSV versions of the original objects. @@ -145,7 +146,7 @@ the **InputObject** parameter and converts the CSV strings from the `$Services` When the **UseCulture** parameter is used, be sure that the current culture's default list separator matches the delimiter used in the CSV strings. Otherwise, `ConvertFrom-Csv` can't -generate objects from the CSV strings. +can't parse each column into distinct properties. ### Example 5: Convert CSV data in W3C Extended Log Format @@ -177,12 +178,17 @@ time cs-method cs-uri ### -Delimiter -Specifies the delimiter that separates the property values in the CSV strings. The default is a -comma (`,`). Enter a character, such as a colon (`:`). To specify a semicolon (`;`) enclose it in -single quotation marks. +Specifies the delimiter that separates the property values in the CSV data. The default is a comma +(`,`). + +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single +quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double +quotation marks. -If you specify a character other than the actual string delimiter in the file, `ConvertFrom-Csv` -can't create the objects from the CSV strings and returns the CSV strings. +If the specified character doesn't match the actual delimiter in the CSV data, `ConvertFrom-Csv` +can't parse each column into distinct properties. In this case, it outputs one **PSCustomObject** +per row, each containing a single property whose name is the full header and whose value is the row +text. ```yaml Type: System.Char diff --git a/reference/7.6/Microsoft.PowerShell.Utility/ConvertTo-Csv.md b/reference/7.6/Microsoft.PowerShell.Utility/ConvertTo-Csv.md index 268917fbef92..4521d66a274c 100644 --- a/reference/7.6/Microsoft.PowerShell.Utility/ConvertTo-Csv.md +++ b/reference/7.6/Microsoft.PowerShell.Utility/ConvertTo-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 03/14/2023 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/convertto-csv?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: ConvertTo-Csv @@ -11,6 +11,7 @@ title: ConvertTo-Csv # ConvertTo-Csv ## SYNOPSIS + Converts .NET objects into a series of character-separated value (CSV) strings. ## SYNTAX @@ -186,7 +187,10 @@ only the key is converted to CSV. ### -Delimiter Specifies the delimiter to separate the property values in CSV strings. The default is a comma -(`,`). Enter a character, such as a colon (`:`). To specify a semicolon (`;`) enclose it in single +(`,`). + +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single +quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double quotation marks. ```yaml diff --git a/reference/7.6/Microsoft.PowerShell.Utility/Export-Csv.md b/reference/7.6/Microsoft.PowerShell.Utility/Export-Csv.md index e0efa06265ac..f6aed2d3ddf1 100644 --- a/reference/7.6/Microsoft.PowerShell.Utility/Export-Csv.md +++ b/reference/7.6/Microsoft.PowerShell.Utility/Export-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 03/15/2023 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/export-csv?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 aliases: @@ -13,6 +13,7 @@ title: Export-Csv # Export-Csv ## SYNOPSIS + Converts objects into a series of character-separated value (CSV) strings and saves the strings to a file. @@ -179,10 +180,15 @@ This example describes how to export objects to a CSV file and use the **Append* objects to an existing file. ```powershell -$AppService = (Get-Service -DisplayName *Application* | Select-Object -Property DisplayName, Status) +$AppService = Get-Service -DisplayName *Application* | + Select-Object -Property DisplayName, Status + $AppService | Export-Csv -Path .\Services.Csv -NoTypeInformation Get-Content -Path .\Services.Csv -$WinService = (Get-Service -DisplayName *Windows* | Select-Object -Property DisplayName, Status) + +$WinService = Get-Service -DisplayName *Windows* | + Select-Object -Property DisplayName, Status + $WinService | Export-Csv -Path .\Services.csv -NoTypeInformation -Append Get-Content -Path .\Services.Csv ``` @@ -221,7 +227,8 @@ unexpected output is received, troubleshoot the pipeline syntax. ```powershell Get-Date | Select-Object -Property DateTime, Day, DayOfWeek, DayOfYear | - Export-Csv -Path .\DateTime.csv -NoTypeInformation + Export-Csv -Path .\DateTime.csv -NoTypeInformation + Get-Content -Path .\DateTime.csv ``` @@ -232,7 +239,8 @@ Get-Content -Path .\DateTime.csv ```powershell Get-Date | Format-Table -Property DateTime, Day, DayOfWeek, DayOfYear | - Export-Csv -Path .\FTDateTime.csv -NoTypeInformation + Export-Csv -Path .\FTDateTime.csv -NoTypeInformation + Get-Content -Path .\FTDateTime.csv ``` @@ -456,8 +464,11 @@ Accept wildcard characters: False ### -Delimiter -Specifies a delimiter to separate the property values. The default is a comma (`,`). Enter a -character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in quotation marks. +Specifies a delimiter to separate the property values. The default is a comma (`,`). + +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single +quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double +quotation marks. ```yaml Type: System.Char diff --git a/reference/7.6/Microsoft.PowerShell.Utility/Import-Csv.md b/reference/7.6/Microsoft.PowerShell.Utility/Import-Csv.md index 2fa2ddfa0444..794c152f7b4c 100644 --- a/reference/7.6/Microsoft.PowerShell.Utility/Import-Csv.md +++ b/reference/7.6/Microsoft.PowerShell.Utility/Import-Csv.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 01/09/2025 +ms.date: 12/27/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/import-csv?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 aliases: @@ -13,6 +13,7 @@ title: Import-Csv # Import-Csv ## SYNOPSIS + Creates table-like custom objects from the items in a character-separated value (CSV) file. ## SYNTAX @@ -284,8 +285,8 @@ Import-Csv -Path .\Projects.csv ``` ```Output -WARNING: One or more headers weren't specified. Default names starting with "H" have been used in -place of any missing headers. +WARNING: One or more headers weren't specified. Default names starting with "H" have been +used in place of any missing headers. ProjectID ProjectName H1 Completed --------- ----------- -- --------- @@ -305,12 +306,14 @@ displays a warning message because **H1** is a default header name. Specifies the delimiter that separates the property values in the CSV file. The default is a comma (`,`). -Enter a character, such as a colon (`:`). To specify a semicolon (`;`) enclose it in single +Enter a character, such as a colon (`:`). To specify a semicolon (`;`), enclose it in single quotation marks. To specify escaped special characters such as tab (`` `t ``), enclose it in double quotation marks. -If you specify a character other than the actual string delimiter in the file, `Import-Csv` can't -create the objects from the CSV strings and returns the full CSV strings. +If the specified character doesn't match the actual delimiter in the CSV data, `Import-Csv` can't +parse each column into distinct properties. In this case, it outputs one **PSCustomObject** per +row, each containing a single property whose name is the full header and whose value is the row +text. ```yaml Type: System.Char