How to change keyboard layout via command line cmd.exe on Windows XP/7?

138,212

Solution 1

yes.

Configuring Regional and Language Options International Settings with command line automation

Windows Vista Command Line Configuration of International Settings

command line example:

control intl.cpl,, /f:"%CD%\AddKeyboardLanguage.xml"

AddKeyboardLanguage.xml example:

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend"> 
<gs:UserList>
<gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/></gs:UserList> 
<gs:InputPreferences> 

<!--ch-Google--><gs:InputLanguageID Action="add" ID="0804:E0200804"/>

</gs:InputPreferences>
</gs:GlobalizationServices>

RemoveKeyboardLanguage.xml example:

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend"> 
<gs:UserList>
<gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/></gs:UserList> 
<gs:InputPreferences> 

<!--ch-Google--><gs:InputLanguageID Action="remove" ID="0804:E0200804"/>

</gs:InputPreferences>
</gs:GlobalizationServices>

Solution 2

No (not via CMD), you will have to change it the following way. There used to be a keyb.com command in DOS but that no longer exists in Windows.

Source:

Windows 7 or Windows Vista

  1. Click Start, type intl.cpl in the Start Search box, and then press ENTER.
  2. On the Keyboards and Language tab, click Change keyboards. Click Add.
  3. Expand the language that you want. For example, expand French (Canada).
  4. Expand Keyboard list, click to select the Canadian French check box, and then click OK.
  5. In the options, click View Layout to compare the layout with the actual keyboard.
  6. In the Default input language list, click French (Canada) – Canadian French, and then click OK two times.
  7. In the Regional and Language Options dialog box, click OK.
  8. Click the Language bar, and then click FR French (Canada).

Windows XP

  1. Click Start , type intl.cpl in the Run box, and then press ENTER.
  2. On the Languages tab, click Details.
  3. Under Installed services, click Add.
  4. In the Input language list, select the language that you want. For example, select French (Canada) .
  5. In the Keyboard layout/IME list, click Canadian French, and then click OK.
  6. In the Select one of the installed input languages to use when you start your computer list, click French (Canada) – Canadian French, and then click OK.
  7. In the Regional and Language Options dialog box, click OK.
  8. Click the Language bar, and then click French (Canada).

But you can in Linux using loadkeys.

Solution 3

Windows 8 brings a new International PowerShell module. Unfortunately it doesn't seem like this can be backported or has any Windows 7 alternative


Configure international settings by using PowerShell cmdlets

In Windows 8 you can use the International Settings PowerShell cmdlets to change the language on a running Windows installation. The benefit of using PowerShell cmdlets is that you can incorporate them into a script to facilitate deployment and configuration of Windows. Source: http://technet.microsoft.com/en-us/library/hh825705.aspx

  1. Open a Windows PowerShell prompt.
  2. Import the international settings module by running the following command:

    ipmo international

  3. Display the locale information on the computer by running the following command:

    Get-WinSystemLocale

  4. Set the locale for the region and language that you want. For example, the following command sets the system locale to Japanese (Japan):

    Set-WinSystemLocale ja-JP

Solution 4

For information: Set-WinUserLanguageList as suggested in other answers does not just change the active keyboard input language, it overwrites your current list of (enabled) input languages. To set up two languages or more that you can switch between, use something along these lines:

Set-WinUserLanguageList -Force en-US,sv-SE

The language given as the first argument to the list will be selected as the active language, so this can be an efficient way to change both active language and the overall list of keyboard languages available.

Solution 5

"Windows 8 brings a new International PowerShell module. Unfortunately it doesn't seem like this can be backported or has any Windows 7 alternative"

You could try this (example).. this enables only the selected keyboard layouts and clears the others

Install-Module -name timezone -force
#Sets the systems timezone on "Western Europe Standard time" 
$langlist = New-WinUserLanguageList en-US

#Clears the other input methods from the displayed language
$langlist[0].InputMethodTips.Clear()

#Sets and adds the swiss-German keyboard
$langlist[0].InputMethodTips.add('0409:00000807')

#Sets and adds the swiss-french keyboard
$langlist[0].InputMethodTips.add('0409:0000100C')

#Apply the changes made on the system (and force to avoid the prompt  message)
Set-WinUserLanguageList $langlist -Force
Share:
138,212

Related videos on Youtube

JohnnyFromBF
Author by

JohnnyFromBF

Updated on September 18, 2022

Comments

  • JohnnyFromBF
    JohnnyFromBF over 1 year

    Is is possible to change the keyboard layout via command line on Windows XP/7?

  • studiohack
    studiohack about 12 years
    Cheers! +1 to you! :)
  • doctorate
    doctorate over 9 years
    I wonder if there is any command form the cmd just to tell which keyboard layout your are currently using in Windows7? I mean a command that returns a string value of the language layout you are using -- not changing the layout just inquiring.
  • jiggunjer
    jiggunjer almost 8 years
    This answer changes the locale. It doesn't seem to affect keyboards, at most the codepage will be different.
  • yasouser
    yasouser about 7 years
    Set-WinUserLanguageList -Force 'ja-JP' will change the keyboard input language. Note the use of -Force is only to not get the popup dialog. Get-WinUserLanguageList will give you the list of languages available to user for typing.
  • nilon
    nilon almost 4 years
    linkrot! updateable?
  • Dr.Sherif Omran
    Dr.Sherif Omran about 3 years
    if you are not admin and normal user, this solved my issue when i click and run as administrator from inside my user. Changing from the administrator account did not solve my issue and the solution was to call intl.cpl with run as administrator.