
However, if you relay an external program's output via PowerShell, VT sequences are recognized using Out-Host is the simplest way to do that ( Write-Host would work too).
Geektool big sur windows 10#
PowerShell automatically activates VT (virtual terminal) support for itself when it starts (in recent releases of Windows 10 this applies to both Windows PowerShell and PowerShell (Core) 7+) - but that does not extend to external programs called from Windows PowerShell (but does when called from PowerShell (Core) as of at least 7.2.2). In that event, option (c) (from PowerShell), discussed next, may work for you. If you have a preexisting executable that you cannot modify. from the Start Menu or Task Bar) wouldn't respect these settings, because *.lnk files have settings built into them while you can modify these built-in settings via the Properties GUI dialog, as of this writing the VirtualTerminalLevel setting is not surfaced in that GUI.Ĭalling the SetConsoleMode() Windows API function from inside the program (process), as shown here, is cumbersome even in C# (due to requiring P/Invoke declarations), and may not be an option:įor programs written in languages from which calling the Windows API is not supported. While there is a mechanism that allows console-window settings to be scoped by startup executable / window title, via subkeys of, the VirtualTerminalLevel value seems not to be supported there.Įven if it were, however, it wouldn't be a robust solution, because opening a console window via a shortcut file ( *.lnk) (e.g. Individual executables / shells can still deactivate support for themselves, if desired, using method (b).Ĭonversely, however, this means that the output of any program that doesn't explicitly control VT support will be subject to interpretation of VT sequences while this is generally desirable, hypothetically this could lead to misinterpretation of output from programs that accidentally produce output with VT-like sequences. The registry-based approach invariably activates VT support globally, i.e., for all console windows, irrespective of what shell / program runs in them: (c) Ad-hoc workaround, from PowerShell: pipe output from external programs to Out-Host e.g. (b) Activate support from inside your program, for that program (process) only, with a call to the SetConsoleMode() Windows API function. Open a new console window for changes to take effect.Reg add HKCU\Console /v VirtualTerminalLevel /t REG_DWORD /d 1 From cmd.exe (also works from PowerShell):.Set-ItemProperty HKCU:\Console VirtualTerminalLevel -Type DWORD 1 From PowerShell, you can do this programmatically as follows:.In short: In registry key, create or set the VirtualTerminalLevel DWORD value to 1.(a) Activate support globally by default, persistently, via the registry, as detailed in this SU answer.

While console windows in Windows 10 do support VT (Virtual Terminal) / ANSI escape sequences in principle, support is turned OFF by default.

The following applies to regular (legacy) console windows on Windows (provided by conhost.exe), which are used by default, including when a console application is launched from a GUI application.īy contrast, the console windows (terminals) provided by Windows Terminal provide support for VT / ANSI escape sequences by default, for all console applications.
