windows 批处理文件中的国际字符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4388222/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
International characters in a batch file
提问by Rune Aamodt
Hey, I'm having some problems writing a batch file where I need to specify some file paths containing international characters (the norwegian letter '?' to be exact).
嘿,我在编写批处理文件时遇到了一些问题,我需要在其中指定一些包含国际字符的文件路径(准确地说是挪威字母 '?')。
For example, the filename axportef?ljedb.vbp
(which looks normal in notepad) turns into axportef°ljedb.vbp
on the command line, which the system then goes on to complain about not finding.
例如,文件名axportef?ljedb.vbp
(在记事本中看起来很正常)axportef°ljedb.vbp
在命令行上变成了,然后系统继续抱怨找不到。
Any suggestions?
有什么建议?
采纳答案by Andrei Pana
It will work if you save your batch file as ANSI with a Norwegian character set (with Notepad++ for example). Then, in the cmd, when you want to run your batch file, first change the code page to something that supports Norwegian: chcp 1252 (in the console).
如果您将批处理文件保存为带有挪威语字符集的 ANSI(例如使用 Notepad++),它将起作用。然后,在 cmd 中,当您要运行批处理文件时,首先将代码页更改为支持挪威语的内容:chcp 1252(在控制台中)。