![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | stderr from external program to write-error Hi, I have the following problem: my PS script calls an external program (actually a template processor). The external program writes error messages to stderr. I have verified this by redirecting output with 2>err.txt. When running the PS script, the error messages from the external program are easily overlooked because they are obviously written to the PS output pipeline rather than to the error pipeline. To say it another way: I would like the error message from the external program appear as red on black as if they written with Write- Error. I'm using PS only occasional and I wasn't able to find a solution or even a "best practice" how to handle errors from external programs. Any help? Thanks a lot. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: stderr from external program to write-error If you're stuck with PowerShell v1, I believe you are out of luck. If you're considering v2, then check this as it may help: http://www.nivot.org/2009/08/19/Powe...gerModule.aspx Oisin mentioned he was planning to add even more features to the above. Marco "wofat68" <atlanticcoast2006@xxxxxx> wrote in message news:b0b54f4f-23c1-4db2-9150-3b7af4073996@xxxxxx Quote: > Hi, > > I have the following problem: my PS script calls an external program > (actually a template processor). The external program writes error > messages to stderr. I have verified this by redirecting output with > 2>err.txt. When running the PS script, the error messages from the > external program are easily overlooked because they are obviously > written to the PS output pipeline rather than to the error pipeline. > To say it another way: I would like the error message from the > external program appear as red on black as if they written with Write- > Error. > > I'm using PS only occasional and I wasn't able to find a solution or > even a "best practice" how to handle errors from external programs. > > Any help? > > Thanks a lot. > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: stderr from external program to write-error On Sep 11, 5:19*pm, "Marco Shaw [MVP]" <marco.shaw@xxxxxx_SPAMgmail.com> wrote: Quote: > If you're stuck with PowerShell v1, I believe you are out of luck. *If > you're considering v2, then check this as it may help:http://www.nivot.org/2009/08/19/Powe...leAndFlexibleS... My idea was to redirect stderr to a PS variable for later analysis and output with Write-Error. I played around with Invoke-Expression and the -ErrorVariable parameter. No success so far. I'm probably doing something wrong here. Documentation is quite sparse. Is there at least a way to catch stderr without redirecting to a temporary file? That would be an enormous help. Thanks. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| External USB HDDs - Write Caching | General Discussion | |||
| Write-Error doesn't write anyting | PowerShell | |||
| External HDD drive write protected on vistax64 | Vista hardware & devices | |||
| No write-access from Vista to files created by XP on external driv | Vista account administration | |||
| Unable to write files to iPod or external hard drive. | Vista General | |||