Which batch command can I use to detect the currently used system language, (not the default language)?
I have code which checks the default system language and goes to a separate code depending on whether the detected language is Polish or another = English:
@echo OFF
FOR /F "tokens=2 delims==" %%l IN ('wmic os get OSLanguage /Value') DO set OSLanguage=%%l
IF %OSLanguage% == 1045 GOTO L_POLISH
IF %OSLanguage% NEQ 1045 GOTO L_ENGLISH
:L_POLISH
echo Polish was detected
pause
exit
:L_ENGLISH
echo English was detected
pause
exit
The problem is that if we install the system in e.g. Polish, and then change the language in the system to English, German, etc., the code will not detect and will not set/display and will not go to the code for the English version, but will detect the default Polish and go to Polish code.
What command can I use as a check to make the code verify the currently used version of the system language instead of the default language?
1045
instead of0415
, (as clearly shown in yourdism
output). As far as I know there is no language which uses1045
, so your code will alwaysGOTO L_ENGLISH
.0415
, and your OSLanguage is in a decimal LCID format,1045
. Incidentally, if you take a look at the other properties and values from yourWMIC OS
command, you should also note that there's aLocale
property, which will use the hex LCID, and also aMUILanguages
property which will provide an array of the installed language packs in string format, e.g.{"en-US","pl-PL"}