-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Write-error gives weird symbols when using >> to redirect it to a file. #14655
Copy link
Copy link
Closed
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
Metadata
Metadata
Assignees
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
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
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