locked
What command can be run from the cmd to inquire about the language layout that is used right now? RRS feed

  • Question

  • I have windows 7 32bit platform. Is there any command that can be run from the command line just to inquire about the language bar that is currently in use? Suppose I have English keyboard on my machine but I am switching between 3 languages when I write my documents (e.g. English, German, Spanish). I want to know if there is any way to tell what language layout that is in current use as seen in the language bar. This question is not about how to change language layout from the command line -- just to know what layout. For example, the command can return some sort of string to indicate which layout is currently in use: "english", "german", "spanish", and so on.

    My ultimate goal from this question is to pass this output into an external editor that will hopefully change font based on the input language? Any help to achieve this goal will be much appreciated.

    Or put differently, what is the best way to tell an external editor like Emacs about the current language layout that is in current use?


    • Edited by doctorate Monday, November 17, 2014 12:28 PM
    Monday, November 17, 2014 9:45 AM

Answers

  • For the current input language you can try using

    reg query "HKCU\Keyboard Layout\Preload" /v 1

    The return value includes an eight digit hex value. The first four digits indicate either default layout for the language (all zeros) or a variation (non-zero). The last four digits are the locale id - see:

    http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

    From this table, you can see in the example above my input language is English - Australia. 

    For the keyboard layout you could try

    WMIC Path Win32_Keyboard Get Layout

    0409 is an English - US keyboard.

    For a few other ideas/methods try reading

    http://p0w3rsh3ll.wordpress.com/2013/06/07/about-keyboard-layouts/


    • Edited by mystifeid Wednesday, November 26, 2014 2:55 AM
    • Proposed as answer by Roger Lu Wednesday, December 3, 2014 9:49 AM
    • Marked as answer by Yolanda Zhu Tuesday, December 9, 2014 10:11 AM
    Wednesday, November 26, 2014 2:31 AM

All replies

  • Hi,

    I'm afraid the answer is no, untill  now, I didn't find any cmd or powershell command could achieve the goal to  get current input method status.

    The command systeminfo could used to get system input locale but not input method.


    Roger Lu
    TechNet Community Support

    Monday, November 24, 2014 7:35 AM
  • How to use systeminfo to tell system locale?  this can also be helpful only if the value returned will change according to the selected layout. 
    • Edited by doctorate Tuesday, November 25, 2014 8:42 PM
    Tuesday, November 25, 2014 8:33 PM
  • For the current input language you can try using

    reg query "HKCU\Keyboard Layout\Preload" /v 1

    The return value includes an eight digit hex value. The first four digits indicate either default layout for the language (all zeros) or a variation (non-zero). The last four digits are the locale id - see:

    http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

    From this table, you can see in the example above my input language is English - Australia. 

    For the keyboard layout you could try

    WMIC Path Win32_Keyboard Get Layout

    0409 is an English - US keyboard.

    For a few other ideas/methods try reading

    http://p0w3rsh3ll.wordpress.com/2013/06/07/about-keyboard-layouts/


    • Edited by mystifeid Wednesday, November 26, 2014 2:55 AM
    • Proposed as answer by Roger Lu Wednesday, December 3, 2014 9:49 AM
    • Marked as answer by Yolanda Zhu Tuesday, December 9, 2014 10:11 AM
    Wednesday, November 26, 2014 2:31 AM