Skip to content

The output of $Error[1] | Out-String contains ANSI escape sequences #13416

@Shayan-To

Description

@Shayan-To

Steps to reproduce

Try
{
    Throw 'Some error.'
}
Catch
{
    $E = $_
}
$E | Out-String
$E | Out-File Test.txt

Expected behavior

Exception: Some error.

Actual behavior

�[91mException: �[91mSome error.�[0m

Environment data

Name                           Value
----                           -----
PSVersion                      7.1.0-preview.5
PSEdition                      Core
GitCommitId                    7.1.0-preview.5
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.WG-Interactive-Consolethe console experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions