Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Write-error gives weird symbols when using >> to redirect it to a file. #14655

Copy link
Copy link
@langsgalgenrad

Description

@langsgalgenrad
Issue body actions

I have been looking around on the web and could not find a solution or a topic about it. My apologies if there is somewhere. When I use the write-error and redirect the output to a file it will result in weird symbols in the file. The other ones like write-warning or write-output work fine.

Steps to reproduce

Write-Output "Lalala" 1> C:\Temp\test.txt 
Write-Error "This is a test" 2>&1 >> C:\Temp\test.txt 
Write-Warning "Test Testt" 3>&1 >> C:\Temp\test.txt 
Write-Information "Information Information" 6>&1 >> C:\Temp\test.txt 

Expected behavior

Output in the file:

Lalala
C:\Users\MoonChild\Documents\huh.ps1 : This is a test
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,huh.ps1
Test Testt
Information Information

Actual behavior

Output in the file:

Lalala
�[91mWrite-Error: �[91mThis is a test�[0m
Test Testt
Information Information

Environment data

PSVersion 7.1.1
PSEdition Core
GitCommitId 7.1.1
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Reactions are currently unavailable

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 aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility moduleWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.