Print non-printable character (VS Code)

411 Views Asked by At

I am writing a batch file in VS Code and I have a question. What are the ways to insert a non-printable character other than copying it from somewhere.

enter image description here

I have tried Alt+27, Alt+027, Alt+001b... but it doesn't work.

The question is not only in terms of echo, but in general about VSC. What are the possibilities to insert a non-printable character in VS Code? In the command line console, I can do this:

enter image description here

where ^[ is the non-printable Esc character typed in Alt+027. But how to do this in VSC when there is a need to insert a non-printable character? Alternatively, I can always write an extension for VSC that will open, copy and paste such characters, but it is useful when it is not possible to simply print them.

1

There are 1 best solutions below

5
On

It's not a good idea to have non-printable characters in a text file. You can use the escape sequence \e instead:

echo "\e[32m color green \e[0m"