Windows下快速切换全拼/双拼

Windows下快速切换全拼/双拼

bat批处理文件方式

change.bat

1
2
3
4
5
6
@echo off

set Mainkey=HKCU\SOFTWARE\Microsoft\InputMethod\Settings\CHS
for /f %%i in ('reg query %MainKey% /v "Enable Double Pinyin" ^| findstr /i "0x1"') do (set flg=%%i)
if not defined flg ( reg add %MainKey% /v "Enable Double Pinyin" /t REG_DWORD /d 0x1 /f ) else ( reg add %MainKey% /v "Enable Double Pinyin" /t REG_DWORD /d 0x0 /f )
pause

ChangeAll.bat

1
2
3
4
5
6
7
8
9
10
11
@echo off

set Mainkey=HKCU\SOFTWARE\Microsoft\InputMethod\Settings\CHS

for /f %%i in ('reg query %MainKey% /v "Enable Double Pinyin" ^| findstr /i "0x1"') do (set flg=%%i)

if not defined flg (
@REM reg add %MainKey% /v "Enable Double Pinyin" /t REG_DWORD /d 0x1 /f
) else (
reg add %MainKey% /v "Enable Double Pinyin" /t REG_DWORD /d 0x0 /f
)

ChangeDouble.bat

1
2
3
4
5
6
7
8
9
10
11
12
13
@echo off

set Mainkey=HKCU\SOFTWARE\Microsoft\InputMethod\Settings\CHS

for /f %%i in ('reg query %MainKey% /v "Enable Double Pinyin" ^| findstr /i "0x1"') do (set flg=%%i)

if not defined flg (
reg add %MainKey% /v "Enable Double Pinyin" /t REG_DWORD /d 0x1 /f
) else (
@REM reg add %MainKey% /v "Enable Double Pinyin" /t REG_DWORD /d 0x0 /f
)

pause

VBS脚本方式

vbs

1
2
CreateObject("WScript.Shell").Run "ChangeAll.bat",0
CreateObject("WScript.Shell").Run "ChangeDouble.bat",0

uTools插件

目前已经做成了 uTools 插件 , 插件名称 : 切换微软全拼

项目地址: https://github.com/syyu6/utools-ChangeDouble

And so on …

utools快捷命令

实现 ps1 脚本

1
2
3
4
5
$out = reg query HKCU\SOFTWARE\Microsoft\InputMethod\Settings\CHS /v "Enable Double Pinyin"; 
$outStr = $out -as [string];
if ($outStr -match '(Pinyin.+0x)(\d)') {$mode = $Matches[2] } else { $mode = 1 };
if ($mode -as [int] -eq 1) { $Double = 0 } else { $Double = 1 };
reg.exe add HKCU\SOFTWARE\Microsoft\InputMethod\Settings\CHS /v "Enable Double Pinyin" /t REG_DWORD /d $Double /f;