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

up vote 11 down vote accepted

yes.

http://blogs.msdn.com/b/shawnste/archive/2007/04/12/configuring-international-settings-from-the-command-line.aspx

http://msdn.microsoft.com/en-us/goglobal/bb964650#eyb

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>
  • 2
    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. – doctorate Nov 17 '14 at 9:02

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

  • 1
    This answer changes the locale. It doesn't seem to affect keyboards, at most the codepage will be different. – jiggunjer Aug 3 '16 at 1:23
  • 2
    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. – yasouser May 12 '17 at 2:26

"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

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.

$psdrive = New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS

Set-ItemProperty -Path "HKU:\.DEFAULT\Keyboard Layout\Preload\" -Name 1 -Value 00001033

$psdrive | Remove-PSDrive

This works fine in the Windows 7 PowerShell but you have to logout and back in to enable ist it changes the layout to English if you want another language you have to change the -Value number you can find them here: https://www.science.co.il/language/Locale-codes.php

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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