0

I want to echo output to Powershell stdout. The suggested methods of using Write-Host (Debug/Versbose) writes to console as expected but when I redirect the output to a file with >> it keeps writing to the console.

What is the full equivalient to "echo" in Powershell? Echo works but the use of it is discouraged from my code editor (VS Code).

allnau
  • 323
  • 1
  • 5
  • 2
    Does this answer your question? [Echo equivalent in PowerShell for script testing](https://stackoverflow.com/questions/707646/echo-equivalent-in-powershell-for-script-testing) – Cililing Jan 14 '21 at 09:11
  • 1
    Does this answer your question? [How to output something in PowerShell](https://stackoverflow.com/questions/2038181/how-to-output-something-in-powershell) – zett42 Jan 14 '21 at 09:24
  • @Cililing This isn't a good dupe, because the accepted answer deals only with outputting something to the console / debug / verbose streams. OP requires that output be redirectable which requires output to the success stream. – zett42 Jan 14 '21 at 09:59

1 Answers1

2

echo in PowerShell is just an alias to Write-Output, and you can always use it instead of its alias.

The reason why Visual Studio Code discouraged you to use echo is just because that aliases will downgrade you code's readibility.