切换(添加/删除)键盘语言(1 cmd)

时间:2016-05-04 16:57:56

标签: windows batch-file cmd

我有两个.cmd(bat)文件来添加/删除键盘(输入)语言:

LangAdd.cmd:

control intl.cpl,, /f:"LangAdd.xml"

LangRemove.cmd:

control intl.cpl,, /f:"LangRemove.xml"

LangAdd.xml:

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<gs:UserList>
<gs:User UserID="Current"/> 
</gs:UserList>
<gs:InputPreferences> 
<gs:InputLanguageID Action="add" ID="0412:{A028AE76-01B1-46C2-99C4-ACD9858AE02F}{B5FE1F02-D5F2-4445-9C03-C568F23C99A1}"/> 
</gs:InputPreferences> 
</gs:GlobalizationServices>

LangRemove.xml:

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<gs:UserList>
<gs:User UserID="Current"/> 
</gs:UserList>
<gs:InputPreferences> 
<gs:InputLanguageID Action="remove" ID="0412:{A028AE76-01B1-46C2-99C4-ACD9858AE02F}{B5FE1F02-D5F2-4445-9C03-C568F23C99A1}"/> 
</gs:InputPreferences> 
</gs:GlobalizationServices>

但我只想使用一个cmd文件 - 切换添加/删除语言

我该怎么做?

1 个答案:

答案 0 :(得分:1)

我刚刚使用了if..else语句:

IF EXIST REG QUERY "HKCU\Keyboard Layout\Preload" /d 00000412 (
    control intl.cpl,, /f:"LangRemove.xml" 
) ELSE ( 
    control intl.cpl,, /f:"LangAdd.xml"
)