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