FG
💻 Software

Using powershell call native command-line app and capture STDERR

Fresh5 days ago
Mar 15, 202614737 views
Confidence Score0%
0%

Problem

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: Is there a better way? P.S. I intend to post one solution I've found and compare it to answers from others.

Error Output

PS> dos2unix.exe -n StartApp.sh StartApp_fixed.sh
dos2unix.exe : dos2unix: converting file StartApp.sh to file StartApp_fixed.sh in UNIX format ...
A…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Using powershell call native command-line app and capture STDERR

Low Risk

No, alas. This ugliness is an by-design feature of Powershell :( If an application prints to standard error (and anything else is listening), then Powershell wraps each line in an obfuscating 'NativeCommandError' object. See https://stackoverflow.co…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment