Skip to content

Latest commit

 

History

History
29 lines (19 loc) · 753 Bytes

feedback_nonewline.md

File metadata and controls

29 lines (19 loc) · 753 Bytes

NoNewLine parameter

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.

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.