Programmatically change keyboard to Dvorak

后端 未结 2 639
囚心锁ツ
囚心锁ツ 2021-01-01 10:21

Does anyone know the API call I can use to change the keyboard layout on a windows machine to Dvorak? Doing it through the UI is easy but I\'d like to have a script that I

2条回答
  •  暖寄归人
    2021-01-01 11:11

    You can do this via the registry. Just save it as a .reg file, and open it on the new VM. I believe this should do it for remapping to Dvorak:

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
    "ScanCode Map"=hex:00,00,00,00,00,00,00,00,22,00,00,00,2d,00,30,00,24,00,2e,00,\
    11,00,33,00,33,00,11,00,12,00,20,00,34,00,12,00,1b,00,0d,00,0d,00,1b,00,16,\
    00,21,00,17,00,22,00,20,00,23,00,1a,00,0c,00,2e,00,17,00,23,00,24,00,14,00,\
    25,00,31,00,26,00,35,00,1a,00,30,00,31,00,13,00,18,00,26,00,19,00,2f,00,34,\
    00,28,00,10,00,0c,00,28,00,19,00,13,00,18,00,1f,00,1f,00,27,00,2c,00,35,00,\
    15,00,14,00,22,00,16,00,25,00,2f,00,10,00,2d,00,21,00,15,00,27,00,2c,00,00,\
    00,00,00
    

    And if you want to go back:

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
    "ScanCode Map"=hex:00,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00
    

提交回复
热议问题