Paramètre NoNewLineNoNewLine parameter

Les applets de commande Out-File, Add-Content et Set-Content ont maintenant un nouveau commutateur –NoNewline qui omet tout simplement une nouvelle ligne après la sortie.Out-File, Add-Content, and Set-Content now have a new –NoNewline switch which simply omits a new line after the output.

PS C:\> "This is " | Out-File -FilePath Example.txt -NoNewline

PS C:\>; "a single " | Add-Content -Path Example.txt -NoNewline

PS C:\> "sentence." | Add-Content -Path Example.txt -NoNewline

PS C:\> Get-Content .\Example.txt

This is a single sentence.

Si vous ne spécifiez pas –NoNewline, chaque fragment est sur une ligne distincte :Without –NoNewline specified, each fragment would be on a separate line:

PS C:\> "This is " | Out-File -FilePath Example.txt

PS C:\> "a single " | Add-Content -Path Example.txt

PS C:\> "sentence." | Add-Content -Path Example.txt

PS C:\> Get-Content .\Example.txt

This is

a single

sentence.