To detect the Windows Operating system language, it is enough to query the registry. We use the “reg query” command and then parse the output.
@echo off setlocal :: https://docs.microsoft.com/en-us/previous-versions/office/developer/speech-technologies/hh361638(v=office.14) for /F "usebackq tokens=3" %%a IN (`reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage`) DO ( set lang_id=%%a ) :: 0409 English ; 0407 German ; 040C French ; 0C0A Spanish if "%lang_id%"=="0409" ( echo English detected ) else if "%lang_id%" == "040C" ( echo French detected ) else ( echo Note: Unknown language ID %lang_id%! ) echo LangID=%lang_id%
You can learn about advanced Batch scripting techniques in the Batchography book.
![]()
Do you want to master Batch Files programming? Look no further, the Batchography is the best book on the topic and the most up to date!
Available in print or e-book editions from Amazon.
![]()
![]()
You might also like:
