You are not logged in.

#1 19 Oct 2015 23:44

Batcher
Member
Registered: 20 Jul 2015
Posts: 56

using special symbols in batch file

Hello I have batch file that contains the characters áéíóúü and ñ but when I use the echo command cmd displayes a different character than I would like how can I fix this thanks!

Offline

#2 20 Oct 2015 10:32

bluesxman
Member
From: UK
Registered: 29 Dec 2006
Posts: 1,129

Re: using special symbols in batch file

This a hacky way to do it that I use occaisionaly. Paste something like this directly into the cmd window -- don't run it as a script, for (hopefully) obvious reasons:

for %X in (a-acc:á e-acc:é i-acc:í o-acc:ó u-acc:ú u:uml:ü n-til:ñ) do (@echo:%X) >> international.txt

Open the resulting file in notepad or similar, then copy and paste the "actual" characters to your script in the appropriate places (they'll look wrong in the editor, but should be OK when you run the script).

There is probably a better way to do it with encoding settings in your text editor, but I don't often use international characters so never looked into it.

Last edited by bluesxman (20 Oct 2015 10:50)


cmd | *sh | ruby | chef

Offline

#3 20 Oct 2015 21:02

Batcher
Member
Registered: 20 Jul 2015
Posts: 56

Re: using special symbols in batch file

Thank you so much smile

Offline

#4 20 Oct 2015 21:31

Shadow Thief
Member
Registered: 12 Jul 2012
Posts: 205

Re: using special symbols in batch file

It's usually a result of having a different code page in notepad vs command prompt. Personally, my cmd code page is 437, while my Windows code page is 1252. You may want to experiment with the CHCP command to see what works best for you.

Offline

Board footer

Powered by