How to Check System Locale Settings in Windows 7 Command Prompt (CMD)


1 views

Unlike UNIX-based systems that use formats like cs_CZ.UTF-8, Windows handles localization differently. The system locale in Windows determines:

  • Default code page for non-Unicode programs
  • Date/time/number formatting
  • Character encoding for legacy applications

chcp Command /h2>

The quickest way to check the active code page (which relates to locale):

chcp
Active code page: 1250

Common code pages:

  • 1252: Western European
  • 1250: Central European
  • 1251: Cyrillic
  • 65001: UTF-8

For complete locale information, query the registry:

reg query "HKCU\Control Panel\International" /v Locale

Sample output:

Locale    REG_SZ    00000405

The hex value corresponds to LCID (Locale ID). For example:

  • 0405: Czech (Czech Republic)
  • 0409: English (United States)

For more detailed information:

powershell -command "Get-WinSystemLocale"

Output example:

LCID             Name             DisplayName
----             ----             -----------
1029             cs-CZ            Czech (Czech Republic)

To approximate the cs_CZ.UTF-8 format:

@echo off
for /f "tokens=2*" %%A in ('reg query "HKCU\Control Panel\International" /v Locale ^| find "Locale"') do (
  set "lcid=%%B"
)

if "%lcid%"=="00000405" (
  echo cs_CZ.UTF-8
) else if "%lcid%"=="00000409" (
  echo en_US.UTF-8
)
  • Windows doesn't natively use POSIX locale strings
  • The system locale differs from user locale settings
  • For UTF-8 support, you'll need Windows 10 version 1903 or later

In Windows 7, the system locale determines the default language for non-Unicode programs and affects how certain system functions interpret characters. Unlike Unix-like systems that use formats like cs_CZ.UTF-8, Windows has its own way of handling locale settings.

Windows doesn't have a direct locale command like Linux, but you can retrieve similar information using these methods:

@echo off
:: Method 1: Using WMIC to get locale identifier
wmic os get locale
:: Returns output like: 0409 (for English-US)

:: Method 2: Checking registry values
reg query "HKCU\Control Panel\International" /v Locale
reg query "HKCU\Control Panel\International" /v sCountry
reg query "HKCU\Control Panel\International" /v sLanguage

To convert Windows locale IDs (like 0409) to standard formats (like en_US), you can use this PowerShell script:

$culture = [System.Globalization.CultureInfo]::CurrentCulture
Write-Host "$($culture.Name).$($culture.TextInfo.ANSICodePage)"

PowerShell provides more comprehensive locale information:

Get-Culture | Select-Object Name, DisplayName, LCID, KeyboardLayoutId
Get-WinSystemLocale
[System.Threading.Thread]::CurrentThread.CurrentCulture
[System.Threading.Thread]::CurrentThread.CurrentUICulture

Here's a complete batch script that outputs locale information in a readable format:

@echo off
setlocal enabledelayedexpansion

:: Get locale ID
for /f "tokens=2 delims==" %%a in ('wmic os get locale /value ^| findstr "Locale"') do (
    set LCID=%%a
)

:: Get country and language from registry
for /f "tokens=3" %%a in ('reg query "HKCU\Control Panel\International" /v sCountry 2^>nul ^| findstr "sCountry"') do (
    set COUNTRY=%%a
)

for /f "tokens=3" %%a in ('reg query "HKCU\Control Panel\International" /v sLanguage 2^>nul ^| findstr "sLanguage"') do (
    set LANGUAGE=%%a
)

echo System Locale Information:
echo -------------------------
echo Locale ID: !LCID!
echo Country: !COUNTRY!
echo Language: !LANGUAGE!

Remember that Windows handles locale differently than Unix systems:

  • Windows uses LCID (Locale ID) numbers rather than POSIX locale strings
  • The encoding is typically determined by the code page rather than UTF-8 suffixes
  • User-specific settings may differ from system-wide settings