Windows XP中 - CMD.EXE - 转换为utf8 codePAGE后无法执行批处理文件 [英] Windows XP - cmd.exe - Cannot execute batch file after switching to utf8 codepage

查看:465
本文介绍了Windows XP中 - CMD.EXE - 转换为utf8 codePAGE后无法执行批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与切换为utf8 codePAGE后模式CON CP选择= 65001,批量处理接缝停止没有任何错误消息的工作。

After switching to utf8 codepage with "mode con cp select=65001", batch processing seams to stop working without any error messages.

因此​​,执行与$ C $ 437 CPAGE 850或正在积极工作正常刚开始控制台的cmd.exe / c test.bat的。
执行模式CON CP选择= 65001工作正常。
的UTF-8字符显示效果还算不错。
执行类似回声喂!正常工作。

Thus, executing "cmd.exe /c test.bat" in a freshly started console with codepage 437 or 850 being active works fine. Executing "mode con cp select=65001" works fine. Display of UTF-8-characters works fine. Executing something like "echo Hallo!" works fine.

但在执行的cmd.exe / c test.bat的停止与显示错误消息的工作。

But executing "cmd.exe /c test.bat" stops working with no error message displayed.

这不仅是一个显示错误:该批处理文件并没有得到执行

It's not only a display error: The batch file does not get executed.

切换回的老字符集让它重新正常工作。
切换来回UTF8字符集让它停止工作了。

Switching back to any "old" character set lets it work fine again. Switching forth to UTF8 character set lets it stop working again.

当然,从UTF8弃权是一个解决方案 - 但不良副作用的背景

Of course, abstaining from UTF8 IS a solution - but with bad side effects in the background.

推荐答案

我不知道你怎么能启动codePAGE后一个批处理文件更改为65001结果
即使您保存UTF16-LE或批处理文件UTF16-是它不会启动。

I don't know how you can start a batch file after the codepage is changed to 65001.
Even if you save the batch file in utf16-le or utf16-be it doesn't start.

但你可以运行一个批处理文件,然后将里面的codePAGE,结果
但重要的是在code的其余部分中的块被缓存(括号或&线)。

But you can run a batch file and change the codepage inside,
but it is important that the rest of the code is cached in a block (parenthesis or ampersand line).

@echo off
(
chcp 65001
rem Do my UTF work
chcp 850
)
echo This works

chcp 65001 & type myFile & chcp 850
echo This also works

这篇关于Windows XP中 - CMD.EXE - 转换为utf8 codePAGE后无法执行批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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