Using powershell call native command-line app and capture STDERR
Posted
by
crtracy
on Super User
See other posts from Super User
or by crtracy
Published on 2010-11-22T19:20:40Z
Indexed on
2011/01/14
1:55 UTC
Read the original article
Hit count: 296
I'm using a port of a cygwin tool on Windows which writes normal status messages to STRERR. This produces ugly output when run from PowerShell:
PS> dos2unix.exe -n StartApp.sh StartApp_fixed.sh
dos2unix.exe : dos2unix: converting file StartEC3.sh to file StartEC3_fixed.sh in UNIX format ...
At line:1 char:13
+ dos2unix.exe <<<< -n StartApp.sh StartApp_fixed.sh
+ CategoryInfo : NotSpecified: (dos2unix: conve...UNIX format ...:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Is there a better way?
P.S. I intend to post one solution I've found and compare it to answers from others.
© Super User or respective owner