Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to know the language of Windows 2k,2k3 or XP in batch script ?

722 views
Skip to first unread message

Alextophi

unread,
Feb 8, 2006, 4:16:04 AM2/8/06
to
hello,

how to know the language of Windows 2k,2k3 or XP ?

EN, FR, IT... in a script bat or cmd.


Tanks ?

foxidrive

unread,
Feb 8, 2006, 4:44:20 AM2/8/06
to

Alextophi

unread,
Feb 8, 2006, 5:08:31 AM2/8/06
to
it is not good information. The bond goes towards the method to know
parameters keyboard and monay currency, etc. but not the language of
version Windows.

Timo Salmi

unread,
Feb 9, 2006, 7:55:24 AM2/9/06
to
Alextophi wrote:

> it is not good information.

Au contraire. Foxdrive's was very good information.

> The bond goes towards the method to know parameters keyboard and
> monay currency, etc. but not the language of version Windows.

I beg your pardon?

All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Useful script files and tricks ftp://garbo.uwasa.fi/pc/link/tscmd.zip

Matthias Tacke

unread,
Feb 9, 2006, 3:12:01 PM2/9/06
to
Alextophi schrieb:

> it is not good information. The bond goes towards the method to know
> parameters keyboard and monay currency, etc. but not the language of
> version Windows.
>
Timo is right,
the information provided by foxidrives link includes in one posting:

reg query "HKEY_CURRENT_USER\Control Panel\International"

execute this in a cmd window.
All needed information should be displayed.

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

OTOH internationalization is a complex issue. If you want to get deeper
into this, read:
http://www.microsoft.com/globaldev/reference/win2k/setup/default.mspx
http://www.microsoft.com/globaldev/reference/winxp/langtla.mspx
http://www.microsoft.com/globaldev/nlsweb/default.asp
http://www.microsoft.com/globaldev/reference/localetable.mspx

HTH
Matthias

Timo Salmi

unread,
Feb 10, 2006, 2:39:47 AM2/10/06
to
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. (note the potential wrapping)
@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

> http://www.microsoft.com/globaldev/reference/winxp/langtla.mspx

Which, in turns shows
English - United States ENU 0409

Very good!

Timo Salmi

unread,
Feb 10, 2006, 2:54:19 AM2/10/06
to
Timo Salmi wrote:
> E.g. (note the potential wrapping)
> @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

Now the big equestion remains. Will that work as such on a say,
French or German XP? Could anyone with such a system please verify?
Or does the language extend as far as to the register key names?

foxidrive

unread,
Feb 10, 2006, 3:31:11 AM2/10/06
to
On Fri, 10 Feb 2006 09:54:19 +0200, Timo Salmi wrote:

> Timo Salmi wrote:
>> E.g. (note the potential wrapping)
>> @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
>
> Now the big equestion remains. Will that work as such on a say,
> French or German XP? Could anyone with such a system please verify?
> Or does the language extend as far as to the register key names?

Reports ENA ( English - Australia) correctly.

foxidrive

unread,
Feb 10, 2006, 3:36:37 AM2/10/06
to
On Fri, 10 Feb 2006 09:54:19 +0200, Timo Salmi wrote:

> Timo Salmi wrote:
>> E.g. (note the potential wrapping)
>> @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
>
> Now the big equestion remains. Will that work as such on a say,
> French or German XP? Could anyone with such a system please verify?
> Or does the language extend as far as to the register key names?

Timo, it'd be useful for the country info to be displayed as the web page
address could change in the future, so I added the info in the batch file.
Watch for line wrapping:


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

if "%lang_%"=="AFK" echo Afrikaans - South Africa
if "%lang_%"=="SQI" echo Albanian - Albania
if "%lang_%"=="ARG" echo Arabic - Algeria
if "%lang_%"=="ARH" echo Arabic - Bahrain
if "%lang_%"=="ARE" echo Arabic - Egypt
if "%lang_%"=="ARI" echo Arabic - Iraq
if "%lang_%"=="ARJ" echo Arabic - Jordan
if "%lang_%"=="ARK" echo Arabic - Kuwait
if "%lang_%"=="ARB" echo Arabic - Lebanon
if "%lang_%"=="ARL" echo Arabic - Libya
if "%lang_%"=="ARM" echo Arabic - Morocco
if "%lang_%"=="ARO" echo Arabic - Oman
if "%lang_%"=="ARQ" echo Arabic - Qatar
if "%lang_%"=="ARA" echo Arabic - Saudi Arabia
if "%lang_%"=="ARS" echo Arabic - Syria
if "%lang_%"=="ART" echo Arabic - Tunisia
if "%lang_%"=="ARU" echo Arabic - U.A.E.
if "%lang_%"=="ARY" echo Arabic - Yemen
if "%lang_%"=="HYE" echo Armenian - Armenia
if "%lang_%"=="AZE" echo Azeri - Azerbaijan (Cyrillic)
if "%lang_%"=="AZE" echo Azeri - Azerbaijan (Latin)
if "%lang_%"=="EUQ" echo Basque - Spain
if "%lang_%"=="BEL" echo Belarusian - Belarus
if "%lang_%"=="BGR" echo Bulgarian - Bulgaria
if "%lang_%"=="CAT" echo Catalan - Spain
if "%lang_%"=="ZHH" echo Chinese - Hong Kong SAR
if "%lang_%"=="ZHM" echo Chinese - Macau SAR
if "%lang_%"=="CHS" echo Chinese - PRC
if "%lang_%"=="ZHI" echo Chinese - Singapore
if "%lang_%"=="CHT" echo Chinese - Taiwan
if "%lang_%"=="HRV" echo Croatian - Croatia
if "%lang_%"=="CSY" echo Czech - Czech Republic
if "%lang_%"=="DAN" echo Danish - Denmark
if "%lang_%"=="DIV" echo Divehi - Maldives
if "%lang_%"=="NLB" echo Dutch - Belgium
if "%lang_%"=="NLD" echo Dutch - Netherlands
if "%lang_%"=="ENA" echo English - Australia
if "%lang_%"=="ENL" echo English - Belize
if "%lang_%"=="ENC" echo English - Canada
if "%lang_%"=="ENB" echo English - Caribbean
if "%lang_%"=="ENI" echo English - Ireland
if "%lang_%"=="ENJ" echo English - Jamaica
if "%lang_%"=="ENZ" echo English - New Zealand
if "%lang_%"=="ENP" echo English - Philippines
if "%lang_%"=="ENS" echo English - South Africa
if "%lang_%"=="ENT" echo English - Trinidad
if "%lang_%"=="ENG" echo English - United Kingdom
if "%lang_%"=="ENU" echo English - United States
if "%lang_%"=="ENW" echo English - Zimbabwe
if "%lang_%"=="ETI" echo Estonian - Estonia
if "%lang_%"=="FOS" echo Faeroese - Faeroe Islands
if "%lang_%"=="FAR" echo Farsi - Iran
if "%lang_%"=="FIN" echo Finnish - Finland
if "%lang_%"=="FRB" echo French - Belgium
if "%lang_%"=="FRC" echo French - Canada
if "%lang_%"=="FRA" echo French - France
if "%lang_%"=="FRL" echo French - Luxembourg
if "%lang_%"=="FRM" echo French - Monaco
if "%lang_%"=="FRS" echo French - Switzerland
if "%lang_%"=="MKI" echo FYRO Macedonian - FYRO Macedonia
if "%lang_%"=="GLC" echo Galician - Spain
if "%lang_%"=="KAT" echo Georgian - Georgia
if "%lang_%"=="DEA" echo German - Austria
if "%lang_%"=="DEU" echo German - Germany
if "%lang_%"=="DEC" echo German - Liechtenstein
if "%lang_%"=="DEL" echo German - Luxembourg
if "%lang_%"=="DES" echo German - Switzerland
if "%lang_%"=="ELL" echo Greek - Greece
if "%lang_%"=="GUJ" echo Gujarati - India (Gujarati Script)
if "%lang_%"=="HEB" echo Hebrew - Israel
if "%lang_%"=="HIN" echo Hindi - India
if "%lang_%"=="HUN" echo Hungarian - Hungary
if "%lang_%"=="ISL" echo Icelandic - Iceland
if "%lang_%"=="IND" echo Indonesian - Indonesia
if "%lang_%"=="ITA" echo Italian - Italy
if "%lang_%"=="ITS" echo Italian - Switzerland
if "%lang_%"=="JPN" echo Japanese - Japan
if "%lang_%"=="KAN" echo Kannada - India (Kannada Script)
if "%lang_%"=="KKZ" echo Kazakh - Kazakstan
if "%lang_%"=="KNK" echo Konkani - India
if "%lang_%"=="KOR" echo Korean(Extended Wansung) - Korea
if "%lang_%"=="KYR" echo Kyrgyz - Kyrgyzstan
if "%lang_%"=="LVI" echo Latvian - Latvia
if "%lang_%"=="LTH" echo Lithuanian - Lithuania
if "%lang_%"=="MSB" echo Malay - Brunei Darussalam
if "%lang_%"=="MSL" echo Malay - Malaysia
if "%lang_%"=="MAR" echo Marathi - India
if "%lang_%"=="MON" echo Mongolian (Cyrillic) - Mongolia
if "%lang_%"=="NOR" echo Norwegian - Norway (Bokmål)
if "%lang_%"=="NON" echo Norwegian - Norway (Nynorsk)
if "%lang_%"=="PLK" echo Polish - Poland
if "%lang_%"=="PTB" echo Portuguese - Brazil
if "%lang_%"=="PTG" echo Portuguese - Portugal
if "%lang_%"=="PAN" echo Punjabi - India (Gurmukhi Script)
if "%lang_%"=="ROM" echo Romanian - Romania
if "%lang_%"=="RUS" echo Russian - Russia
if "%lang_%"=="SAN" echo Sanskrit - India
if "%lang_%"=="SRB" echo Serbian - Serbia (Cyrillic)
if "%lang_%"=="SRL" echo Serbian - Serbia (Latin)
if "%lang_%"=="SKY" echo Slovak - Slovakia
if "%lang_%"=="SLV" echo Slovenian - Slovenia
if "%lang_%"=="ESS" echo Spanish - Argentina
if "%lang_%"=="ESB" echo Spanish - Bolivia
if "%lang_%"=="ESL" echo Spanish - Chile
if "%lang_%"=="ESO" echo Spanish - Colombia
if "%lang_%"=="ESC" echo Spanish - Costa Rica
if "%lang_%"=="ESD" echo Spanish - Dominican Republic
if "%lang_%"=="ESF" echo Spanish - Ecuador
if "%lang_%"=="ESE" echo Spanish - El Salvador
if "%lang_%"=="ESG" echo Spanish - Guatemala
if "%lang_%"=="ESH" echo Spanish - Honduras
if "%lang_%"=="ESM" echo Spanish - Mexico
if "%lang_%"=="ESI" echo Spanish - Nicaragua
if "%lang_%"=="ESA" echo Spanish - Panama
if "%lang_%"=="ESZ" echo Spanish - Paraguay
if "%lang_%"=="ESR" echo Spanish - Peru
if "%lang_%"=="ESU" echo Spanish - Puerto Rico
if "%lang_%"=="ESN" echo Spanish - Spain (International Sort)
if "%lang_%"=="ESP" echo Spanish - Spain (Traditional Sort)
if "%lang_%"=="ESY" echo Spanish - Uruguay
if "%lang_%"=="ESV" echo Spanish - Venezuela
if "%lang_%"=="SWK" echo Swahili - Kenya
if "%lang_%"=="SVF" echo Swedish - Finland
if "%lang_%"=="SVE" echo Swedish - Sweden
if "%lang_%"=="SYR" echo Syriac - Syria
if "%lang_%"=="TAM" echo Tamil - India
if "%lang_%"=="TTT" echo Tatar - Tatarstan
if "%lang_%"=="TEL" echo Telugu - India (Telugu Script)
if "%lang_%"=="THA" echo Thai - Thailand
if "%lang_%"=="TRK" echo Turkish - Turkey
if "%lang_%"=="UKR" echo Ukrainian - Ukraine
if "%lang_%"=="URD" echo Urdu - Pakistan
if "%lang_%"=="UZB" echo Uzbek - Uzbekistan (Cyrillic)
if "%lang_%"=="UZB" echo Uzbek - Uzbekistan (Latin)
if "%lang_%"=="VIT" echo Vietnamese - Viet Nam
endlocal&pause& goto :EOF

Timo Salmi

unread,
Feb 10, 2006, 3:42:57 AM2/10/06
to
foxidrive wrote:
>>> for /f "tokens=3" %%i in ('reg query "HKEY_CURRENT_USER\Control
>>>Panel\International" ^| find "sLanguage"') do (

> Reports ENA ( English - Australia) correctly.

Yes, but "Australian" is English. I am wary about the sLanguage which
is why we need a non-English confirmation as well.

Mike Jones

unread,
Feb 10, 2006, 7:04:14 AM2/10/06
to
foxidrive wrote:
>
> Timo, it'd be useful for the country info to be displayed as the web
> page
> address could change in the future, so I added the info in the batch
> file.
> Watch for line wrapping:
>
>
> @echo off & setlocal enableextensions
> for /f "tokens=3" %%i in ('reg query "HKEY_CURRENT_USER\Control
> Panel\International" ^| find "sLanguage"') do ( set lang_=%%i)
> if "%lang_%"=="AFK" echo Afrikaans - South Africa
> if "%lang_%"=="SQI" echo Albanian - Albania
[...]

> if "%lang_%"=="URD" echo Urdu - Pakistan
> if "%lang_%"=="UZB" echo Uzbek - Uzbekistan (Cyrillic)
> if "%lang_%"=="UZB" echo Uzbek - Uzbekistan (Latin)

Erranoo! duplicate spotted!, you'd have to use the LCId to distinguish
them, or maybe Microsoft have misallocated the TLAs.
(info from
http://www.microsoft.com/globaldev/reference/winxp/langtla.mspx
)

[...]

Matthias Tacke

unread,
Feb 10, 2006, 9:48:57 AM2/10/06
to
Timo Salmi schrieb:

> foxidrive wrote:
>>>> for /f "tokens=3" %%i in ('reg query "HKEY_CURRENT_USER\Control
>>>> Panel\International" ^| find "sLanguage"') do (
>
>> Reports ENA ( English - Australia) correctly.
>
> Yes, but "Australian" is English. I am wary about the sLanguage which
> is why we need a non-English confirmation as well.
>
> All the best, Timo
>
DEU is correctly reported for German - Germany.

BTW the op seems to look for 2letter (english?) abbreveations .

I didn't check in detail how ms lcid relates to ISO 3166:
http://www.iso.org/iso/en/prods-services/iso3166ma/index.html


HTH
--
Greetings
Matthias

Matthias Tacke

unread,
Feb 10, 2006, 10:24:42 AM2/10/06
to
Matthias Tacke schrieb:

> BTW the op seems to look for 2letter (english?) abbreveations .
>
> I didn't check in detail how ms lcid relates to ISO 3166:
> http://www.iso.org/iso/en/prods-services/iso3166ma/index.html
>

Some more links:
http://www.unicode.org/onlinedat/countries.html
http://www.w3.org/WAI/ER/IG/ert/iso639.htm
http://www.loc.gov/standards/iso639-2/langcodes.html

As I said before It's a complex matter. The op should explain in
detail what he's after.

--
Greetings
Matthias

Timo Salmi

unread,
Feb 10, 2006, 1:07:38 PM2/10/06
to
Matthias Tacke wrote:
> Timo Salmi schrieb:

>>>>> for /f "tokens=3" %%i in ('reg query "HKEY_CURRENT_USER\Control
>>>>> Panel\International" ^| find "sLanguage"') do (

> DEU is correctly reported for German - Germany.

Matthias, thank you for the confirmation. Appreciated. Now I can
add to the FAQ
131} How to get the language of Windows XP in a script ?

Alextophi

unread,
Feb 13, 2006, 8:00:47 AM2/13/06
to
hello,

.\Filever.exe /A /D %SystemRoot%\system32\ntoskrnl.exe >.\ver.dat

find /i "FRA" .\ver.dat
find /i "ENU" .\ver.dat
...


that's all

christophe

(Filever.exe is a res.kit file)

Timo Salmi

unread,
Feb 17, 2006, 5:13:56 PM2/17/06
to
Timo Salmi wrote:
>>>>>> for /f "tokens=3" %%i in ('reg query "HKEY_CURRENT_USER\Control
>>>>>> Panel\International" ^| find "sLanguage"') do (

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

Alextophi

unread,
Feb 20, 2006, 8:44:35 AM2/20/06
to
hello timo,

your two methods are false.

If the linguistic parameters are changed (keyboard, money, metric
system) into FRANCE, the turned over values will be FRA or 040c or
french, etc. And Windows server is US!

cordially
Christophe

Alextophi

unread,
Feb 20, 2006, 9:03:57 AM2/20/06
to
hello Timo.

They is false. On an English wiondows server, if the linguistic
parameters (keyborad, metric and money) are set to French language, the
'reg query "HKEY_CURRENT_USER\Control Panel\International"' is false
and your other method too.


best regard.
christophe

Timo Salmi

unread,
Feb 20, 2006, 9:50:08 AM2/20/06
to

Dear Christophe

The feedback is much highly appreciated. Unfotunately, it is sligthly
too vague and generic for me to be able to utilize it.

0 new messages