Managing code pages in a CMD window when running batch scripts

I have problems managing character codes in a Windows cmd window or, rather, in DOS scripts (.bat files) that I use for certain tasks on my Windows 7 office computer.

Here is the problem:

One of my scripts is used to open certain files in their respective programs, for example.

C:\Stuff\Büroeinrichtung\MyFile.xlsx

An important point here is u-umlaut (ü) in the directory name.

In my script I use

Start "" "C:\Stuff\Büroeinrichtung\MyFile.xlsx"

to start Excel and open the file.

This works as long as I tell my text editor (Notepad ++) to encode the script using code page 850 (Western European), since this is what cmd windows on my computer use by default.

, , - , UTF-8 UTF-8-BOM. , , , script cmd , . chcp 65001 UTF-8. , script

chcp 65001
pause      :: this is here just to have some visual control while testing
Start "" "C:\Stuff\Büroeinrichtung\MyFile.xlsx"
pause      :: dito

: , , . cmd , - ( 2), "enter" I

  • , - ü (, , )
  • , (-, , - ü, , , - )
  • cmd (, , -, 4, ).

, script, script (.bat), .

, : , script, UTF-8 ( ), 850 , ü (u-umlaut) script ü, ?

0

Source: https://habr.com/ru/post/1678242/


All Articles