以编程方式更改键盘布局 [英] Programmatically change Keyboard Layout
问题描述
我在一家瑞士公司环境中工作,使用 de-CH
作为标准键盘布局,同时使用 de-DE
键盘.
I work in a Swiss company environment with de-CH
as the standard keyboard-layout, while using a de-DE
keyboard.
我可以手动将键盘设置更改为首选的 de-DE
布局,将其设置为标准布局并指定快捷键.
I'm able to change my keyboard settings manually to the preferred de-DE
-layout, set it as standard and and assign a shortscut.
然而:不知何故,我的设置在任意时间后消失(可能与管理员运行的更新有关),所以我必须每隔几天重复一次.
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.
这表明有一种简单的方法可以在 Win 8 中使用 Powershell 更改键盘布局:
This suggests there's an easy way to change the keyboard-layout with Powershell in Win 8:
Set-WinUserLanguageList -LanguageList DE-DE
遗憾的是,我使用 Win 7.因此,我收到以下错误消息,作为 Powershell-dummy,我将其解释为 Win 7 中不存在 cmdlet 的简单声明:
Sadly, I work with Win 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 Win 7:
PS C:\Users\b036081> Set-WinUserLanguageList -LanguageList DE-DE
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
现在,Powershell 中是否有另一种相对简单的方法?甚至在 C++、C#、Batch、VB 中...
Now, is there another comparably simple way in Powershell? Or even in C++, C#, Batch, VB...
非常感谢!
推荐答案
虽然我的系统自动重置为 de-CH
布局,如果我将任何其他语言设置为默认,我仍然可以循环到我的ALT
+SHIFT
+1
的首选键盘布局...只要我不尝试删除未使用的 de-CH
条目.
While my system automatically resets to a de-CH
layout IF i set any other language as default, I can still cycle to my prefered keyboard layout with ALT
+SHIFT
+1
... just as long as i dont try to delete the non-used de-CH
entry.
Powershell 方法似乎不适用于我的系统.
The Powershell approach doesn't seem to work with my system.
这篇关于以编程方式更改键盘布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!