|
Re: Output to STDERR PowerShell has its own version of [Console]::Error.WriteLine(), but I noticed neither behave the same in PowerShell.
Try this:
-< t1.ps1 >-
'hi'
[datetime]'text'
$host.ui.WriteErrorLine('ErrorLine1...')
[Console]::Error.WriteLine('ErrorLine2...')
'bye'
-< t1.ps1 >-
# all stdErr is redirected fine from Cmd.exe
cmd
powershell c:\t1 2> c:\err.txt
type c:\err.txt
exit
# not all stdErr redirected in PowerShell
.\t1 2> c:\err.txt
gc c:\err.txt
--
Kiron |