Author Options:

How do you use special characters in cmd? Answered

I'm looking for the arrow (or triangle) symbols to put into a batch program. I know the alt # codes, but I want the codes compatible with ANSI. I have the down arrow, but it's an invisible symbol. Anyone know how to get them? (ASCII numbers are 16, 17, 30, and 31)


ctrl+a - Smiley face
ctrl+b - Dark smiley face
ctrl+d - Diamond
ctrl+e - Clover
ctrl+f - Ace
ctrl+n - Music symbol
crtl+o - Some random circlish symbol
ctrl+p - Left arrow
ctrl+q - Right arrow
ctrl+r - Up and Down arrows
ctrl+t - Line wrap symbol
ctrl+u - Double s
ctrl+v - Thick underscore
ctrl+w - Up and down arrow with a line at the bottom
ctrl+x - Up arrow
ctrl+y - Down arrow

To get the symbols of any of these, do the following in your command prompt:

echo [press the key board combination] > "char.txt"
start char.txt

Then copy and paste the contents of the text file that pops up, and type this code.

del char.txt

This should get you usable characters in batch scripts.


5 years ago

Here is a partial list.



I need the code for ASCII. These only work for Unicode, which I can't use for batch files. Sorry

The only way is to "hard-code" these characters.

for /f "tokens=1-4" %%i in ("A B C D") do (
set "right=%%i"
set "left=%%j"
set "up=%%k"
set "down=%%l"
echo %right% %left% %up% %down%

Unfortunately the forum software doesn't support unprintable ASCII characters. Hence you have to replace the A, B, C and D in this code with a HEX Editor:
HEX 41 to 10, 42 to 11, 43 to 1E and 44 to 1F. Be aware that these characters are probably not displayed as triangles in a normal text editor and also not if you try to redirect them into another file.

Copy/paste the code into a .bat file. Prepend line @echo off, append line pause and save the file.
As I already told you -- first you need a HEX Editor. If you don't have such an editor you'll find a few of them in the internet. E.g. XVI32. That freeware tool comes in a simple zip archive. Extract all files into a folder and run XVI32.exe. Click on File > Open... , navigate to the batch file and open it. Now you see the ASCII characters on the right side and their hexadecimal values on the left side. Click into the cell with the hex value that you want to change and overwrite it with the new value. Have a look at my previous post to see which of them you have to change.

Hope that helped.

Thank you! It worked perfectly!

Alright, thanks. I'll try it out