`Write-Host -NoNewLine` not respected
See original GitHub issuePrerequisites
- I have written a descriptive issue title.
- I have searched all issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
Summary
I have written PowerShell module PSWriteColor which uses Write-Host -NoNewLine pretty much all the time
Write-Host -NoNewline -BackgroundColor Red -Object 'Test'
Write-Host -NoNewline -BackgroundColor Blue -Object 'Test 1'
Write-Host -NoNewline -BackgroundColor DarkGray -Object 'Test 2'
Write-Color -Text 'Test1 ', 'Test2 ','Test3' -Color Red, Blue, DarkGray
PowerShell Version
Name Value
---- -----
PSVersion 5.1.22000.282
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22000.282
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Visual Studio Code Version
1.61.2
6cba118ac49a1b88332f312a8f67186f7f3c1643
x64
Extension Version
ironmansoftware.powershell-universal@2.3.0
ms-vscode.powershell@2021.10.2
ms-vscode.powershell-preview@2021.10.3
tobysmith568.run-in-powershell@1.1.1
TylerLeonhardt.vscode-inline-values-powershell@0.0.5
Steps to Reproduce
Type in powershell editor, press F5
Write-Host -NoNewline -BackgroundColor Red -Object 'Test'
Write-Host -NoNewline -BackgroundColor Blue -Object 'Test 1'
Write-Host -NoNewline -BackgroundColor DarkGray -Object 'Test 2'
Visuals
No response
Logs
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (11 by maintainers)
Top Results From Across the Web
write-host -NoNewline parameter is ignored with powershell 5.1
Starting with WMF 5.1 the -NoNewLine option for Write-Host is essentially ignored. Simple example: PS C:\> Write-Host "no newline test " - ...
Read more >PS -nonewline not work on my console - Microsoft Learn
when I try cmdlet "write-host -nonewline" on my PS console as tutorial(windows10 Home, PS 5.1). PS C:\Windows\system32> write-host "no ...
Read more >Understanding the PowerShell Write-Host Cmdlet
That's because the -NoNewLine parameter isn't really respected since that is mostly a host formatting tool. This may not be a big deal,...
Read more >Is it possible to Write-host with no new line and overwrite the ...
I'm reading that it writes out the characters and then hits backspace which would make me think it always overwrites the last thing...
Read more >Write-Host - PowerShell Command - PDQ
This command displays the input to the console, but because of the NoNewline parameter, the output is followed directly by the prompt. Write...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fix for this has been merged!
Ohh, I see! Thanks Patrick.