Using sixels in prompts (CMD, PowerShell, and Bash / WSL) #17876
PhMajerus
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Using sixels in prompts
This article shows how to embed sixels in string literals to include an image in the prompt in the Command Prompt (cmd.exe), Windows PowerShell (5.x), and PowerShell (6.x and later, pka PS Core).
Command Prompt (cmd.exe)
Here is a
PROMPT
command for cmd.exe to include the MS-DOS logo as a prefix.You can create a batch file containing
@echo off
on the first line and that command on the second line, and provide its path to the Command Processor in the registry atHKCU\Software\Microsoft\Command Processor\AutoRun
(REG_SZ
orREG_EXPAND_SZ
). This will make that command run automatically when launching cmd.exe.PowerShell
Here is a replacement
prompt
function for PowerShell that replaces the textPS
prefix with the modern (black) PowerShell logo using Sixels.Of course, you can include that line in your
$profile
file to do it automatically when launching PowerShell.Windows PowerShell
Here is the equivalent for the legacy (blue) Windows PowerShell logo .
Bash (WSL)
Finally, here is how to embed a sixel logo in a Bash prompt, using the Ubuntu logo .
This can be set in your
~/.bashrc
file to do it automatically when launching bash. For exemple by using the command lineecho "${PS1@A}" >> ~/.bashrc
when you are satisfied with your current prompt.Note however that some features relying on Bash computing the width of the prompt will get slightly confused, such as the tab completion, and up/down history, when it believes the command has reached the end of the line.
Note all of these require a version of Windows Terminal that supports sixels. At the time of this writing, that means Windows Terminal Preview 1.22.2362.0, as the non-preview version is still on 1.20 which does not support sixels.
Beta Was this translation helpful? Give feedback.
All reactions