这是可能的。
http://blogs.msdn.com/b/shawnste/archive/2007/04/12/configuring-international-settings-from-the-command-line.aspx 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 http://msdn.microsoft.com/en-us/goglobal/bb964650#eyb
运行 xml 以添加键盘语言的命令行示例:
control intl.cpl,, /f:"%CD%\AddKeyboardLanguage.xml"
AddKeyboardLanguage.xml用于添加中文键盘语言示例:
<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<gs:UserList>
<gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/></gs:UserList>
<gs:InputPreferences>
<gs:InputLanguageID Action="add" ID="0804:{81D4E9C9-1D3B-41BC-9E6C-4B40BF79E35E}{FA550B04-5AD7-411F-A5AC-CA038EC515D7}"/>
</gs:InputPreferences>
</gs:GlobalizationServices>
删除KeyboardLanguage.xml示例:
<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<gs:UserList>
<gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/></gs:UserList>
<gs:InputPreferences>
<gs:InputLanguageID Action="remove" ID="0804:{81D4E9C9-1D3B-41BC-9E6C-4B40BF79E35E}{FA550B04-5AD7-411F-A5AC-CA038EC515D7}"/>
</gs:InputPreferences>
</gs:GlobalizationServices>
用于添加或删除键盘语言的批处理文件(另存为AddRemWindowsChinese.bat
):
@echo off
if "%1"=="" echo ERROR: Missing [add]/[remove] parameter & goto :USAGE
if /i %1==add (
echo control intl.cpl,, /f:"%CD%\AddWindowsChinese.xml"
control intl.cpl,, /f:"%CD%\AddWindowsChinese.xml"
IF ERRORLEVEL 1 echo An error occured ! && goto :ERROR
)
if /i %1==remove (
echo %CD%
echo control intl.cpl,, /f:"%CD%\RemoveWindowsChinese.xml"
control intl.cpl,, /f:"%CD%\RemoveWindowsChinese.xml"
IF ERRORLEVEL 1 echo An error occured ! && goto :ERROR
)
GOTO :END
:USAGE
echo.
echo USAGE:
echo AddRemWindowsChinese.bat [add ^| remove]
echo.
pause
goto :END
:ERROR
:END