使用了第三方工具IMETOOL(一种输入法设置工具),附件中包含此工具。
更新历史:
2009-02-05 自动搜索 ID 号对应的输入法名称,优化代码结构。 - @echo off
- set IME_K="HKEY_CURRENT_USER\Keyboard Layout\preload"
- set "IME_T=HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layouts"
- setlocal enableDelayedExpansion
- :begin
- cls
- set n=
- echo 原输入法顺序
- for /f "skip=2 tokens=3" %%i in ('reg query %IME_K%') do (
- set/a n+=1
- set ord=!ord!!n!
- set "ime!n!=%%i"
- call :IME_TEXT "%%i" "%IME_T%"
- set "ime_name!n!=!%%i!"
- echo !n!:[!%%i!]
- )
- echo+
- set/p ime_ord=输入新顺序,如(2 1 3):
- set ime_ord=%ime_ord: =%
- if #%ime_ord%==# goto wrong
- echo %ime_ord%|findstr "[^1-%n%]">nul&&goto wrong
- :lp
- if not defined new%ime_ord:~,1% set new_ord=%new_ord%%ime_ord:~,1%
- set "new%ime_ord:~,1%=1"&set "ime_ord=%ime_ord:~1%"
- if defined ime_ord goto lp
- for /l %%k in (1 1 %n%) do (
- call :cut !new_ord:~-%%k,1!
- )
- set new_ord=%new_ord%%ord%
- echo 有效输入为[%new_ord%]
- for /l %%e in (1 1 %n%) do (
- set Nord=!new_ord:~-%%e,1! !Nord!
- )
- for %%n in (%Nord%) do (
- set/a b+=1
- set ime_!b!=!ime%%n!
- echo !b!:[!ime_name%%n!]
- imetool /move3:!ime%%n!,!b!
- )
- echo+
- echo 更改完成。按任意键退出……
- endlocal
- pause>nul
- goto :eof
-
- :wrong
- echo 输入错误,请重新输入
- ping -n 2 127.1>nul
- goto :begin
- :cut
- set ord=!ord:%1=!
- goto :eof
- :IME_TEXT
- for /f "skip=3 tokens=3*" %%n in ('reg query "%~2\%~1" /v "Layout Text"') do (
- set "%~1=%%o"
- )
- goto :eof
复制代码 链接: https://pan.baidu.com/s/1FDG6yu1EUJoOMzQQWXUN6w 提取码: vnnz |