使用 cmd.exe 以 UTF-8 编码保存文本文件 [英] Save text file in UTF-8 encoding using cmd.exe
本文介绍了使用 cmd.exe 以 UTF-8 编码保存文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用 Windows 的命令行 cmd.exe
以 UTF-8 编码保存文本文件?
Is it possible to save a text file in UTF-8 encoding using Windows' command line cmd.exe
?
当前我正在使用命令重定向操作符创建文本文件:
Current I'm creating the text file using command redirection operators:
C:Windowssystem32ipconfig /all >> output.log
我从 >
开始获取一个新文件,然后我使用 >>
附加更多信息.
I start with >
to get a new file and then I use >>
to append more information.
推荐答案
命令提示符的默认编码是 Windows-1252.首先将代码页(chcp 命令)更改为 65001 (UTF-8),然后运行您的命令.
The default encoding for command prompt is Windows-1252. Change the code page (chcp command) to 65001 (UTF-8) first and then run your command.
chcp 65001
C:Windowssystem32ipconfig /all >> output.log
完成后将其更改回默认值.
Change it back to default when done.
chcp 1252
这篇关于使用 cmd.exe 以 UTF-8 编码保存文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文