Mike, these are only "gotchas" if they're not clearly explained. Please use
http://connect.microsoft.com to file doc bugs. If you can include an e-mail
address, I'd be happy to let you review the fixes.
--
June Blender [MSFT]
Windows PowerShell Documentation
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
"mikes.net" wrote:
> 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
>
>