在cmd批处理文件中使用非ASCII字符 [英] Using non-ASCII characters in a cmd batch file

查看:112
本文介绍了在cmd批处理文件中使用非ASCII字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发.bat程序,该程序是用芬兰语编写的.问题在于CMD不知道这些特殊"字母,例如Ä,Ö,Å.

I'm working on a .bat program, and the program is written in Finnish. The problem is that CMD doesn't know these "special" letters, such as Ä, Ö, Å.

有没有办法使这些工作?如果用户也可以使用这些字母,我也很喜欢.

Is there a way to make those work? I'd also like it if the user could use those letters too.

部分代码:

    @echo off
    /u
    title JustATestProgram
    goto test123

    :test123
    echo Letters : Ää Öö Åå
    pause
    exit

当我打开此文件时,字母看起来像这样:

When I open this file, the letters look like this:

推荐答案

尝试将这一行放在批处理文件的顶部:

Try putting this line at the top of the batch file:

chcp 65001

应该将控制台编码更改为UTF-8,之后您应该能够在脚本中正确读取文件.

It should change the console encoding to UTF-8, and you should be able to read the file properly in the script after that.

这篇关于在cmd批处理文件中使用非ASCII字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆