1

I need to install some version of one package depending on the SO language. How can I get it using a batch file? I'm using W7 professional.

4

You would need to identify the language codes that you care about. Here is one reference MS Language Codes. Then you could get the code for the current windows install via wmic in your batch file:

wmic path win32_OperatingSystem get OSLanguage

From David's comment, to set the value, use the WMIC /value switch:

for /f "tokens=2 delims==" %%A in ('wmic path win32_OperatingSystem get OSLanguage /Value') do set Language=%%A
4
  • Thanks for your answer! It works. I found also this other piece of code: set Key="HKEY_CURRENT_USER\Control Panel\International" for /F "tokens=3" %%a in ('reg query %Key% ^| find /i "LocaleName"') do set Language=%%a Dec 26 '12 at 16:18
  • How can I set that to a variable? @EBGreen Dec 26 '12 at 16:21
  • @AbrahamSustaita To set it to a variable use the /Value option and and a for loop parse: for /f "tokens=2 delims==" %%A in ('wmic path win32_OperatingSystem g et OSLanguage /Value') do set Language=%%A Dec 26 '12 at 16:56
  • in batch: delims= not delims==
    – ajcg
    Jun 20 '19 at 22:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.