问题描述
在使用Windows 10或11时,系统有时会自动添加美式键盘布局,而在设置中却无法找到相应的选项进行删除。
即便用户手动删除了美式键盘布局,过一段时间系统仍可能会自动重新添加。这种重复的手动操作无疑是非常繁琐的。
解决方案
创建批处理文件
- 创建一个名为
autoRemove-enUS.bat
的文件。 - 复制并粘贴以下内容:
@ECHO off
chcp 936 >nul
net session >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo This script requires administrator privileges. Please run as administrator.
pause
exit /b
)
(
ECHO ^<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend"^>
ECHO ^<gs:UserList^>^<gs:User UserID="Current"/^>^</gs:UserList^>
ECHO ^<gs:InputPreferences^>
ECHO ^<!-- 添加美式键盘输入 --^>
ECHO ^<gs:InputLanguageID Action="add" ID="0409:00000409"/^>
ECHO ^<!-- 删除美式键盘输入 --^>
ECHO ^<gs:InputLanguageID Action="remove" ID="0409:00000409"/^>
ECHO ^</gs:InputPreferences^>
ECHO ^</gs:GlobalizationServices^>
) > "%~dp0en-USRemove.xml"
if not exist "%~dp0en-USRemove.xml" (
echo Error: Failed to create en-USRemove.xml.
pause
exit /b
)
CONTROL intl.cpl,, /f:"%~dp0en-USRemove.xml"
del "%~dp0en-USRemove.xml" >nul 2>&1
echo Please check if US keyboard layout is removed.
pause
最后,以管理员模式运行脚本。
正文完