Colored text output in PowerShell console using ANSI / VT100 codes

后端 未结 2 2139
旧时难觅i
旧时难觅i 2020-12-01 03:52

I wrote a program which prints a string, which contains ANSI escape sequences to make the text colored. But it doesn\'t work as expected in the default Windows 10 console, a

2条回答
  •  情话喂你
    2020-12-01 04:17

    Thanks to user mklement0 for making me aware that VT support is not enabled automatically. This made me look in the right direction and I found this helpful post.

    So to answer my question: Add or set the registry key

    HKCU:\Console  -  [DWORD] VirtualTerminalLevel = 1
    

    Restart the console and it works.

提交回复
热议问题