# batch and alt codes



## vista_narvas (Nov 6, 2012)

does someone know why a batch file does not display alt codes like how you think it would

```
&#9618; (alt 177)
```
would be displayed as:

```
ª
```
 when i type [alt] 177 in command prompt its shows ▒ but not if i run a batch file with that in it
does some know why this is and what i can do about it?


----------



## Squashman (Apr 4, 2003)

Alt 177 should display as &#9618;
Are you saying it is displaying as ª ?


----------



## vista_narvas (Nov 6, 2012)

Squashman said:


> Alt 177 should display as ▒
> Are you saying it is displaying as ª ?


yes if i make a batch file witch says echo ▒ i get ª but if i use a other character i get something else


----------



## Squashman (Apr 4, 2003)

Works fine for me.


> C:\batch>type alt.bat
> @echo off
> echo ▒
> echo should see a block above
> ...


What code page are you using? Type CHCP at a cmd prompt.
What font is the CMD window using?


----------



## vista_narvas (Nov 6, 2012)

this it in normal cmd









and this it it in a batch file

















this is what i get when i try it in notepad


----------



## foxidrive (Oct 20, 2012)

It is all about code pages. In each code page the character displayed for a given position can be different.

Your text editor that creates your batch file uses one code page.
Your cmd prompt uses another code page.
They may not be the same.

So to display what you see in your batch file - the solution might be to use an editor that is code page aware and you can set it to use the same code page as the cmd prompt. 

And first of all you have to decide which code page to use in your cmd prompt.

CHCP /?

allows you to change code pages.


----------



## vista_narvas (Nov 6, 2012)

cmd uses code page 437 default
what should i use ?
or is there a way to change this in notepad++ ?


----------



## Squashman (Apr 4, 2003)

There is no need to post screen shots of all that stuff. Just copy and paste into the forums.

Windows uses code page 1252 for most English language installs. So the characters you type in any Windows application is going to be different then what you do in the cmd window.


----------



## vista_narvas (Nov 6, 2012)

cmd
Active code page: 1252
¦
¦
¦

the bat file
@echo OFF
chcp 1252
echo ¦
set /p this=
echo %this%
pause


----------



## Squashman (Apr 4, 2003)

A better option would be to create that character on the fly using a little trickery with the FORFILES command.
http://www.dostips.com/forum/viewtopic.php?f=3&t=3857


----------

