I see almost two codes for save the current codepages, but that fails on some languages.
Chcp outputs:
German: ( it have a dot at the end )
Code: Select all
Aktive Codepage: 850.
Code: Select all
使用中字碼頁: 950
Code: Select all
活动的代码页: 936
Code: Select all
現在のコード ページ: 932
Code: Select all
활성 코드 페이지: 949
Code: Select all
Página de códigos activa: 850
Code: Select all
Текущая кодовая страница: 866
Not works for chinese traditional because it uses a different colon character
Code: Select all
for /f "tokens=2 delims=:." %%g in ('chcp') do set "_codepage=%%g"
Code: Select all
for /f "tokens=*" %%a in ('chcp') do for %%b in (%%a) do set "_codepage=%%b"
Code: Select all
for /f "tokens=*" %%a in ('chcp') do for %%b in (%%a) do set "_codepage=%%~nb"
Code: Select all
for /f "tokens=*" %%a in ('chcp'
) do for %%b in (%%a) do for /f "delims=." %%c in ("%%b"
) do set "_codepage=%%c"