I want my PowerShell script to print something like this:
Enabling feature XYZ......Done
The script looks something like this:
There seems to be no way to do this in PowerShell. All of the previous answers are not correct, because they do not behave the way Write-Output
behaves but more like Write-Host
which doesn't have this problem anyway.
The closes solution seems to use Write-Host
with the -NoNewLine
parameter. You can not pipe this which is a problem generally, but there is a way to override this function as described in Write-Host => Export to a file, so you can easily make it accept the parameter for an output file. This is still far from a good solution. With Start-Transcript
this is more usable, but that cmdlet has problems with native applications.
Write-Output
simply can't do what you need in a general context.