Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically change keyboard layout

Tags:

powershell

I work in a Swiss company environment with de-CH as the standard keyboard layout, while using a de-DE keyboard.

I'm able to change my keyboard settings manually to the preferred de-DE-layout, set it as standard and and assign a shortcut.

However: somehow my settings disappear after an arbitrary amount of time (might have something to do with updates the administrators run), so I have to repeat this every couple of days.

This suggests there's an easy way to change the keyboard-layout with PowerShell in Windows 8:

Set-WinUserLanguageList -LanguageList DE-DE

Sadly, I work with Windows 7. Therefore, I get the following error message, which, as a Powershell-dummy, I interpret as a plain statement that the cmdlet doesn't exist in Windows 7:

cd C:\Users\b036081
Set-WinUserLanguageList -LanguageList DE-DE

Output:

Set-WinUserLanguageList : The term 'Set-WinUserLanguageList' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path
is correct and try again.
At line:1 char:1
+ Set-WinUserLanguageList -LanguageList DE-DE
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Set-WinUserLanguageList:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Now, is there another comparably simple way in PowerShell? Or even in C++, C#, Batch, VB...

like image 468
Martin Dreher Avatar asked Mar 10 '26 12:03

Martin Dreher


1 Answers

Use this command

powershell -command "Set-WinUserLanguageList -Force 'en-US'"

or

powershell -command "Set-WinUserLanguageList -Force 'fr-FR'"
like image 114
Orkadia Avatar answered Mar 12 '26 02:03

Orkadia