且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用cmd.exe以UTF-8编码保存文本文件

更新时间:2023-02-20 10:52:07

命令提示符的默认编码为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:\Windows\system32\ipconfig /all >> output.log

完成后将其恢复为默认值。

Change it back to default when done.

chcp 1252