Copyright © 2003-2010 by Prof. Timo Salmi  
Last modified Wed 20-Oct-2010 09:59:34

Assorted NT/2000/XP/.. CMD.EXE Script Tricks
From the html version of the tscmd.zip 1cmdfaq.txt file
To the Description and the Index

This page is edited from the 1cmdfaq.txt faq-file contained in my tscmd.zip command line interface (CLI) collection. That zipped file has much additional material, including a number of detached .cmd script files. It is recommended that you also get the zipped version as a companion.

Please see "The Description and the Index page" for the conditions of usage and other such information.

131} How to get the language of Windows XP in a script?

Matthias Tacke wrote:
> the information provided by foxidrives link includes in one posting:
> reg query "HKEY_CURRENT_USER\Control Panel\International" '

That's nicely advanced, while easy to act on.

> It's no big deal to extract portions in a batch.

  @echo off & setlocal enableextensions
  for /f "tokens=3" %%i in (
    'reg query "HKEY_CURRENT_USER\Control Panel\International" ^| find "sLanguage"') do (
    set lang_=%%i)
  echo %lang_%
  endlocal & goto :EOF

Which would give for example

  @echo off & setlocal enableextensions
  for /F "skip=3 tokens=3" %%i in (
    'reg query "HKEY_CURRENT_USER\Control Panel\International" ^
      /v "sLanguage"') do set lang_=%%i
  endlocal & goto :EOF
  reg query "HKEY_CURRENT_USER\Control Panel\International" /v "sLanguage"
returns e.g.


HKEY_CURRENT_USER\Control Panel\International
    sLanguage REG_SZ ENU

There was a now disappeared link (see the references for some alternatives):
> http://www.microsoft.com/globaldev/reference/winxp/langtla.mspx
Which, in turn showed
  English - United States ENU 0409

A much less accurate method would be to see what is produced by
  ver /?|find "Windows XP"

The output might be e.g.
  Displays the Windows XP version.

Yet another method:
  @echo off & setlocal enableextensions
  for /f "tokens=2 delims=:;" %%i in (
    'systeminfo^|find "System Locale:"') do (
    set lang_=%%i)
  echo %lang_: =%
  endlocal & goto :EOF

The output might be e.g.

References/Comments: (If a Google message link fails try the links within the brackets.)
  Google Groups Feb 10 2006, 11:36 am [M]
  Locale ID (LCID) Chart
  ISO 3166-1 alpha-3 codes
  Table for Language, Locale Names, and Corresponding LCIDs