💾 Archived View for zigford.org › write-information--write-host.gmi captured on 2024-02-05 at 09:41:22. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-03-20)
-=-=-=-=-=-=-
Sharing linux/windows scripts and tips
September 06, 2018 — Jesse Harris
June Blender writing for Hey, Scripting Guy! Blog:
The dilemma was how to fix the harmful aspects of Write-Host (can't suppress, capture, or redirect), but keep it from polluting the output stream. And of course, the solution must be backward compatible.
This most elegant solution is provided by the information stream and the Write-Information cmdlet. The information stream is a new output stream that works much like the error and warning streams.
The information stream is a feature of powershell versions 5.x that I missed when it came out. Thus I have been avoiding using Write-Host in favour of Write-Verbose since reading about Write-Host Considered Harmful.
If you care about writing reusable automation friendly code, go have a read.
Tags:
Generated with bashblog, a single bash script to easily create blogs like this one