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

Color codes captured in Set-Clipboard #17249

Copy link
Copy link
@FireInWinter

Description

@FireInWinter
Issue body actions

Prerequisites

Steps to reproduce

OS: Windows 10, Windows Server 2019
PowerShell Version: 7.2.2, 7.2.3

When outputting data to the clipboard, all color codes are captured as well. This makes it really inconvenient to use the clipboard as the contents are now mangled. These should be stripped when put in the clipboard as they have no use whatsoever as far as I can tell. This is just a simple example of it happening as it happens even when formatting text to be sent in an email (first place I noticed it).
Also Out-String shouldn't be needed either, but that's another ticket (#16431).

Get-PSDrive | Where-Object Name -ne 'Temp' | Select-Object Name, root | Out-String | Set-Clipboard

Then paste it back to notepad, pwsh, Word, or any other app (or at least I haven't found one it looks decent on).

Expected behavior

Name     Root
----     ----
Alias    
C        C:\
Cert     \
D        D:\
Env      
Function 
HKCU     HKEY_CURRENT_USER
HKLM     HKEY_LOCAL_MACHINE
Variable 
WSMan

Actual behavior

�[32;1mName     Root�[0m
�[32;1m----     ----�[0m
Alias    
C        C:\
Cert     \
D        D:\
Env      
Function 
HKCU     HKEY_CURRENT_USER
HKLM     HKEY_LOCAL_MACHINE
Variable 
WSMan

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.3
PSEdition                      Core
GitCommitId                    7.2.3
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No 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.