|
Re: No output from write-output On Apr 10, 8:03 pm, "Marcel J. Ortiz [MSFT]"
<mos...@online.microsoft.com> wrote:
> > Why didn't I get a line saying
> > I got World
>
> Because write-output doesn't write to the console. It sends objects down
> the pipeline which measure-command will then discard. measure-object will
> only output the TimeSpan object for how long it took. write-host will write
> to the console.
> So if you change write-output to write-host you'll get what you expected.
In my opinion outputting text in Powershell is too tricky. There are
various quirks. For example, using Write-Host in a script causes
naked text to stop being output. Format-XXX can't be used inside
scripts. Etc. This whole area could use some documentation. Someone
needs to write a "Powershell Gotchas" article.
But the very worst thing about Powershell is when you have to work on
a machine that doesn't have it.
Mike |