C:\_G\WWW\~ELISANET\INFO\tscmd131.html
<http://www.elisanet.fi/tsalmi/info/tscmd131.html>
Copyright © 2003- by Prof. Timo Salmi  
Last modified Wed 7-Nov-2018 10:01:14

 
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.

E.g.
  @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
  C:\_D\TEST>cmdfaq
  ENU

Or
  @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
  echo.%lang_%
  endlocal & goto :EOF
because
  reg query "HKEY_CURRENT_USER\Control Panel\International" /v "sLanguage"
returns e.g.

! REG.EXE VERSION 3.0

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.
  C:\_D\TEST>cmdfaq
  en-us

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

[Previous] [Next]

C:\_G\WWW\~ELISANET\INFO\tscmd131.html
C:\_G\WWW\~ELISANET\FTPCMD\TSALMI.CMD /tscmd131
http://www.elisanet.fi/tsalmi/info/tscmd131.html
file:///c:/_g/www/~elisanet/info/tscmd131.html