chcp 65001 and a .bat file

前端 未结 6 609
小鲜肉
小鲜肉 2021-02-08 10:59

I have a problem with chcp 65001 command in Windows shell.

I need to generate a list of files in a folder. So I ran cmd.exe, typed

cd folder         


        
6条回答
  •  自闭症患者
    2021-02-08 11:59

    In Windows, make sure that file format of the actual file is same as codepage of the console (cmd.exe). Swedish characters åäö are used commonly.

    In editor (in this case) Notepad++ hit "Encode>Convert to ANSI"

    In script (batchfile) run same codepage as the file (Microsoft's 1252 ANSI version), File:

    chcp 1252
    cd c:\My Folder\Filename_with_åäö-characters.txt
    

    Now it should work.

提交回复
热议问题