在批处理文件中使用Unicode字符 [英] Using Unicode characters in batch file

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

问题描述

我正在创建一个使用以下字符的批处理文件:

I am making a batch file that uses these characters:

˧ ˥ ˪ ˫

它不工作,它只是终止。
我看到人们使用这样的字符:

It is not working, it just terminates itself. I have seen people use characters like this:

Å

它不是字符,但它变成一个字符,有人可以给我一个列表,显示上面的字母类型,它变成什么? / p>

It isnt the character but it turns into a character, can someone give me a list of these, shows the type of letter above and what it turns into?

推荐答案

如果你想编写使用这些字符的控制台批处理文件,你需要一个编辑器来保存批处理文件,代码页。要检查是什么,请输入:

If you want to write console batch files that use those characters, you need an editor that will save the batch file using the console's code page. To check what that is, type:

C:\>chcp
Active code page: 437

这是我的美国Windows系统的结果。

This is the result for my US Windows system.

一个好的编辑器是记事本++ 。在编辑器中设置该编码(编码,字符集,西欧,OEM-US),并将以下字符复制到其中:

A good editor is Notepad++. Set that encoding in the editor (Encoding, Character sets, Western European, OEM-US) and copy the following characters into it:

@echo off
echo ╔═╦═╗ ┌─┬─┐ ╓─╥─╖ ╒═╤═╕
echo ║ ║ ║ │ │ │ ║ ║ ║ │ │ │
echo ╠═╬═╣ ├─┼─┤ ╟─╫─╢ ╞═╪═╡
echo ║ ║ ║ │ │ │ ║ ║ ║ │ │ │
echo ╚═╩═╝ └─┴─┘ ╙─╨─╜ ╘═╧═╛

将文件另存为 test.bat 并从控制台运行:

Save the file as test.bat and run it from the console:

C:\>test
╔═╦═╗ ┌─┬─┐ ╓─╥─╖ ╒═╤═╕
║ ║ ║ │ │ │ ║ ║ ║ │ │ │
╠═╬═╣ ├─┼─┤ ╟─╫─╢ ╞═╪═╡
║ ║ ║ │ │ │ ║ ║ ║ │ │ │
╚═╩═╝ └─┴─┘ ╙─╨─╜ ╘═╧═╛

当您在Notepad ++中再次打开文件时,这样的:

When you open the file again in Notepad++, it is possible that you will see something like:

@echo off
echo ÉÍËÍ» ÚÄÂÄ¿ ÖÄÒÄ· ÕÍÑ͸
echo º º º ³ ³ ³ º º º ³ ³ ³
echo ÌÍÎ͹ ÃÄÅÄ´ ÇÄ×Ķ ÆÍØ͵
echo º º º ³ ³ ³ º º º ³ ³ ³
echo ÈÍÊͼ ÀÄÁÄÙ ÓÄÐĽ ÔÍÏ;

由于文件中没有指示其中的字符代表什么代码页,Notepad ++可以选择所谓的调用 ANSI 代码页。在美国Windows上 Windows-1252 。只需再次选择 OEM-US 编码即可正确显示。

Since there is no indication in the file what code page the characters in it represent, Notepad++ may choose the so-called ANSI code page. On US Windows that is Windows-1252. Just select the OEM-US encoding again to display it properly.

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

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