PTSTao
V2EX  ›  Windows

cmd 中文乱码怎么解决

  •  
  •   PTSTao · Oct 9, 2024 · 1946 views
    This topic created in 588 days ago, the information mentioned may be changed or developed.

    使用公司内部的 C#客户端,每次启动会打开控制台,因为中文乱码导致找不到文件无法启动

    start update.exe ... C:\TP\ClientSetup\update\Update.exe \192.168.1.51\���ù�������װ��\�زIJ��������\�ز�����2.0\Client\ C:\TP\ClientSetup\ResClearClient.exe

    5 replies    2024-10-09 17:27:35 +08:00
    zed1018
        1
    zed1018  
       Oct 9, 2024
    试试勾上这个呢

    PTSTao
        2
    PTSTao  
    OP
       Oct 9, 2024
    @zed1018 勾了,还有能搜到的默认 chcp 65001 和改注册表这些方法都试了,都不行
    Bronya
        3
    Bronya  
       Oct 9, 2024   ❤️ 3
    估计客户端太旧了,别用 65001 ,用 chcp 936 试试
    PTSTao
        4
    PTSTao  
    OP
       Oct 9, 2024
    @Bronya 感谢,用 936 确实可以
    qhd1988
        5
    qhd1988  
       Oct 9, 2024
    1. `bat`文件使用`GBK`编码保存
    2. 执行带中文的命令前先执行`chcp 65001 > nul`
    3. 执行完带中文的命令后,需要执行`chcp 936 > nul`
    4. `bat`文件使用`\r\n`换行
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1187 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 17:43 · PVG 01:43 · LAX 10:43 · JFK 13:43
    ♥ Do have faith in what you're doing.