Ansi Escaping written to console in PowerShell #19068

Closed
opened 2026-01-31 06:32:52 +00:00 by claunia · 4 comments
Owner

Originally created by @Herrmel on GitHub (Dec 14, 2022).

Windows Terminal version

conhost

Windows build number

Microsoft Windows [Version 10.0.19044.1889]

Other Software

PowerShell 7.3

Steps to reproduce

When piping input of an application to an Commandlet like Write-Error the written content contains the ansi escaping signs.
For example the command:

dotnet --version | Write-Verbose -Verbose

Expected Behavior

Printing the following output in yellow:

VERBOSE: 7.0.100

Actual Behavior

The following Text is printed colorless:

�[33;1mVERBOSE: 7.0.100�[0m

Originally created by @Herrmel on GitHub (Dec 14, 2022). ### Windows Terminal version conhost ### Windows build number Microsoft Windows [Version 10.0.19044.1889] ### Other Software PowerShell 7.3 ### Steps to reproduce When piping input of an application to an Commandlet like Write-Error the written content contains the ansi escaping signs. For example the command: ```ps1 dotnet --version | Write-Verbose -Verbose ``` ### Expected Behavior Printing the following output in yellow: ``` VERBOSE: 7.0.100 ``` ### Actual Behavior The following Text is printed colorless: �[33;1mVERBOSE: 7.0.100�[0m
claunia added the Needs-TriageIssue-BugNeeds-Author-FeedbackNo-Recent-Activity labels 2026-01-31 06:32:53 +00:00
Author
Owner

@Herrmel commented on GitHub (Dec 14, 2022):

I opened this Bug in the PowerShell repository first and was guided to this repository.
More Details here: #18771

@Herrmel commented on GitHub (Dec 14, 2022): I opened this Bug in the PowerShell repository first and was guided to this repository. More Details here: [#18771](https://github.com/PowerShell/PowerShell/issues/18771)
Author
Owner

@zadjii-msft commented on GitHub (Dec 14, 2022):

Did you ever call SetConsoleMode with ENABLE_VIRTUAL_TERMINAL_PROCESSING/? That's needed to enable ANSI escape sequences.

@zadjii-msft commented on GitHub (Dec 14, 2022): Did you ever call [`SetConsoleMode`](https://learn.microsoft.com/en-us/windows/console/setconsolemode) with `ENABLE_VIRTUAL_TERMINAL_PROCESSING`/? That's needed to enable ANSI escape sequences.
Author
Owner

@zadjii-msft commented on GitHub (Dec 14, 2022):

Ah wait okay, I'm reading the rest of the context now. This might be a powershell issue.

@zadjii-msft commented on GitHub (Dec 14, 2022): Ah wait okay, I'm reading the rest of the context now. This might be a powershell issue.
Author
Owner

@ghost commented on GitHub (Dec 18, 2022):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Dec 18, 2022): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19068