文档大纲

对付搜狗拼音的偷摸行为:防右键注入及偷装软件

作为一名长期使用搜狗拼音的用户,我不得不承认,近年来这款输入法的体验正在持续下滑。核心输入功能多年未见明显进步,反而广告弹窗问题愈演愈烈,即便使用各种拦截工具也难以彻底根除。

更让我无法接受的是,搜狗拼音近期开始在系统右键菜单中偷偷注入 "彻底粉碎文件"、"添加到压缩文件" 等无关选项。用户一旦误点,就会触发静默安装压缩软件、PDF软件、文件管理软件等等的流程,在后台下载并安装其他软件。这种不尊重用户选择权的捆绑行为,已经严重影响了系统的纯净度和使用体验。

为此,我编写了一个简单的批处理脚本,可以一键清理搜狗拼音注入的所有右键菜单项目,恢复系统右键菜单的纯净状态,从根源上防止误点导致的软件自动安装。

如果你也深受此问题困扰,可以点击下方链接下载使用。

下载: >>>

使用方法

  1. 右键该文件 → 以管理员身份运行(必须管理员,否则无法改注册表、防火墙、目录权限)
  2. 等待 8 步全部完成,按任意键关闭窗口
  3. 重启电脑后再测试右键菜单(Win11 部分扩展需重启才消失)
  4. 查看桌面上的日志文件 SogouCleanup_*.log 了解具体删除了什么

脚本做了什么

步骤内容
清理右键删除 sgshellext、SogouLiXian 等 shell 项,以及已知搜狗 CLSID
Win11 扩展卸载 pdfmenuex1~5 等搜狗 Appx 稀疏包
禁用推广写入 EnableRightClickMenu=0、ShowContextMenu=0 等注册表开关
锁定目录重命名/删除 kdiskmgr_sogou、Components\biz_center 等捆绑目录,并 拒绝写入
阻止私自安装对 SGTool.exe、SogouCloud.exe、SGDownload.exe 等添加 防火墙出站阻止
防复发创建登录计划任务 SogouMenuGuard,每次登录自动重新禁用右键注入项

重要说明

若右键里仍有残留,可在「设置 → 应用 → 已安装的应用」搜索 pdfmenu、sogou、fastpdf 手动卸载。

不会卸载搜狗输入法本体,仍可正常打字;只清理/禁用捆绑推广项。

运行前会自动备份 HKCU\Software\SogouInput 到桌面 .reg 文件,需要时可双击恢复。

阻止 SogouCloud.exe / SGTool.exe 出站后,云词库、皮肤同步 等可能不可用——这是为防私自下载安装的取舍。

若搜狗 大版本更新,可能重新注入;届时再运行一次本脚本即可。登录维护任务也会尽量拦截复发。

如何撤销

如需恢复被锁定的目录或防火墙规则:

删除防火墙规则(管理员 CMD)

netsh advfirewall firewall delete rule name="搜狗-阻止SGTool"

netsh advfirewall firewall delete rule name="搜狗-阻止SogouCloud"

删除登录维护任务

schtasks /Delete /TN "SogouMenuGuard" /F

被 DISABLED_ 前缀重命名的文件夹,需先取得所有权再改回原名。

源码

你也可以把以下代码复制,粘帖到一个本地新建的txt文件中,保存后把文件后缀改为 bat,然后使用管理员权限运行

@echo off
setlocal EnableExtensions EnableDelayedExpansion
chcp 65001 >nul
title 搜狗右键菜单清理与锁定工具

:: ============================================================
::  功能:清理搜狗注入的右键菜单、锁定防复发、阻止私自安装
::  用法:右键本文件 -> 以管理员身份运行
::  说明:不会卸载搜狗输入法本体,仅清理/禁用捆绑推广项
:: ============================================================

set "LOG=%USERPROFILE%\Desktop\SogouCleanup_%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.log"
set "LOG=%LOG: =0%"
set "BACKUP=%USERPROFILE%\Desktop\SogouRegistryBackup_%RANDOM%.reg"
set "SOGOU_ROOT=D:\Program Files (x86)\SogouInput"
set "SOGOU_ROOT_X86=C:\Program Files (x86)\SogouInput"

:: ---------- 管理员权限检查 ----------
net session >nul 2>&1
if %errorlevel% neq 0 (
    echo [提示] 需要管理员权限,正在请求提升...
    powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
    exit /b
)

echo ============================================================ > "%LOG%"
echo 搜狗右键菜单清理与锁定 - 开始时间: %DATE% %TIME% >> "%LOG%"
echo ============================================================ >> "%LOG%"
echo.
echo [1/8] 已获取管理员权限,日志: %LOG%
echo.

:: ---------- 1. 结束搜狗推广/云相关进程 ----------
echo [2/8] 结束搜狗推广相关进程...
call :Log "停止进程..."
for %%P in (
    SogouCloud.exe
    SGTool.exe
    SGDownload.exe
    SGBizHelper.exe
    kwallpaper.exe
    KWallpaperCore.exe
    kdiskmgr.exe
    KDiskMgr.exe
    SogouPdf.exe
    FastPDF.exe
    biz_center.exe
    game_center.exe
) do (
    taskkill /F /IM "%%P" /T >nul 2>&1
    if !errorlevel! equ 0 call :Log "  已结束: %%P"
)

:: ---------- 2. 禁用相关服务 ----------
echo [3/8] 禁用搜狗捆绑服务...
call :Log "禁用服务..."
for %%S in (
    "KWallpaper Core Service"
    "Kwallpaper Core Service"
    "SogouSvc"
    "SogouCoreService"
) do (
    sc query "%%~S" >nul 2>&1
    if !errorlevel! equ 0 (
        sc stop "%%~S" >nul 2>&1
        sc config "%%~S" start= disabled >nul 2>&1
        call :Log "  已禁用服务: %%~S"
    )
)

:: ---------- 3. 删除计划任务 ----------
echo [4/8] 删除搜狗相关计划任务...
call :Log "删除计划任务..."
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
  "$tasks = Get-ScheduledTask -ErrorAction SilentlyContinue | Where-Object { $_.TaskName -match 'Sogou|sogou|SGTool|Kwallpaper|kdiskmgr|pdfmenu|搜狗' -or $_.TaskPath -match 'Sogou|sogou' }; foreach ($t in $tasks) { try { Unregister-ScheduledTask -TaskName $t.TaskName -TaskPath $t.TaskPath -Confirm:$false -ErrorAction Stop; Write-Output ('  已删除任务: ' + $t.TaskPath + $t.TaskName) } catch { Write-Output ('  跳过任务: ' + $t.TaskName + ' - ' + $_.Exception.Message) } }" >> "%LOG%" 2>&1

:: ---------- 4. 备份并清理注册表 ----------
echo [5/8] 备份并清理注册表...
call :Log "备份注册表到: %BACKUP%"
reg export "HKEY_CURRENT_USER\Software\SogouInput" "%BACKUP%" /y >nul 2>&1

call :Log "清理 shell 菜单项..."
for %%K in (
    "HKCR\*\shell\SogouLiXian"
    "HKCR\*\shell\SogouShred"
    "HKCR\*\shell\SogouZip"
    "HKCR\*\shell\SogouCompress"
    "HKCR\Directory\shell\SogouLiXian"
    "HKCR\Directory\shell\SogouShred"
    "HKCR\Directory\shell\SogouZip"
    "HKCR\Directory\Background\shell\SogouLiXian"
    "HKCR\Directory\Background\shell\SogouShred"
    "HKCR\Directory\Background\shell\SogouZip"
    "HKCR\Drive\shell\SogouLiXian"
    "HKCU\Software\Classes\*\shell\SogouLiXian"
    "HKCU\Software\Classes\Directory\shell\SogouLiXian"
    "HKCU\Software\Classes\Directory\Background\shell\SogouLiXian"
) do call :DelRegKey "%%K"

call :Log "清理 ContextMenuHandlers..."
for %%K in (
    "HKCR\*\shellex\ContextMenuHandlers\sgshellext"
    "HKCR\*\shellex\ContextMenuHandlers\sgshellext2"
    "HKCR\Directory\shellex\ContextMenuHandlers\sgshellext"
    "HKCR\Directory\shellex\ContextMenuHandlers\sgshellext2"
    "HKCR\Directory\Background\shellex\ContextMenuHandlers\sgshellext"
    "HKCR\Directory\Background\shellex\ContextMenuHandlers\sgshellext2"
    "HKCR\lnkfile\shellex\ContextMenuHandlers\sgshellext"
    "HKCR\Drive\shellex\ContextMenuHandlers\sgshellext"
    "HKCU\Software\Classes\*\shellex\ContextMenuHandlers\sgshellext"
    "HKCU\Software\Classes\*\shellex\ContextMenuHandlers\sgshellext2"
) do call :DelRegKey "%%K"

call :Log "清理搜狗 CLSID 及 Shell 扩展批准项..."
for %%G in (
    {7BCE96FA-77AF-4288-9E16-2388A50EC807}
    {85212cfd-77ed-4add-8e24-a0a39e3dbfc3}
    {1BB732FA-391B-4648-BC00-8AECA408C065}
    {CBCBBB2F-1367-4ACA-93FA-3382B1F64F8F}
    {E848BEFF-ACF0-47A0-AF07-FF979D036477}
    {A0903F03-4BAE-4B9F-95FE-0A127D625F59}
) do (
    call :DelRegKey "HKCR\CLSID\%%G"
    call :DelRegKey "HKCR\WOW6432Node\CLSID\%%G"
    call :DelRegKey "HKLM\SOFTWARE\Classes\CLSID\%%G"
    call :DelRegKey "HKLM\SOFTWARE\WOW6432Node\Classes\CLSID\%%G"
    reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" /v "%%G" /f >nul 2>&1
)

call :Log "搜索并删除注册表中 Sogou/kdiskmgr/kwallpaper 相关 shell 项..."
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
  "$patterns = @('Sogou','sogou','sgshellext','kdiskmgr','kwallpaper','biz_center','biz_pdf','game_center','pdfmenu','FastPDF','彻底粉碎','压缩文件');" ^
  "$roots = @('Registry::HKEY_CLASSES_ROOT','Registry::HKEY_CURRENT_USER\Software\Classes');" ^
  "foreach ($root in $roots) { Get-ChildItem -Path $root -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.PSChildName -match 'Sogou|sgshellext|kdiskmgr|kwallpaper|pdfmenu|biz_' -or ($_.Property -and (($_.Property | ForEach-Object { [string]$_.GetValue($_.Name) }) -join ' ') -match 'SogouInput|kdiskmgr|kwallpaper|biz_center|biz_pdf|game_center|FastPDF|彻底粉碎|压缩') } | ForEach-Object { try { Remove-Item -LiteralPath $_.PSPath -Recurse -Force -ErrorAction Stop; Write-Output ('  已删除: ' + $_.PSPath) } catch {} } }" >> "%LOG%" 2>&1

call :Log "禁用搜狗右键菜单与自动更新(保留输入法)..."
if not exist "HKCU\Software\SogouInput" reg add "HKCU\Software\SogouInput" /f >nul
if not exist "HKCU\Software\SogouInput\General" reg add "HKCU\Software\SogouInput\General" /f >nul
if not exist "HKCU\Software\SogouInput\SearchEngine" reg add "HKCU\Software\SogouInput\SearchEngine" /f >nul
if not exist "HKCU\Software\SogouInput\Update" reg add "HKCU\Software\SogouInput\Update" /f >nul
reg add "HKCU\Software\SogouInput\General" /v "EnableRightClickMenu" /t REG_DWORD /d 0 /f >nul
reg add "HKCU\Software\SogouInput\SearchEngine" /v "ShowContextMenu" /t REG_DWORD /d 0 /f >nul
reg add "HKCU\Software\SogouInput\Update" /v "AutoUpdate" /t REG_DWORD /d 0 /f >nul
reg add "HKCU\Software\SogouInput\Update" /v "EnableAutoUpdate" /t REG_DWORD /d 0 /f >nul

:: 机器级策略:禁止搜狗云推广(若键不存在则创建)
if not exist "HKLM\SOFTWARE\Policies\SogouInput" reg add "HKLM\SOFTWARE\Policies\SogouInput" /f >nul
reg add "HKLM\SOFTWARE\Policies\SogouInput" /v "DisableCloudPromotion" /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Policies\SogouInput" /v "DisableRightClickMenu" /t REG_DWORD /d 1 /f >nul

:: ---------- 5. 卸载 Win11 Appx _sparse 包(pdfmenuex 等)----------
echo [6/8] 卸载搜狗 Appx 右键扩展包...
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
  "$pkgs = Get-AppxPackage -AllUsers -ErrorAction SilentlyContinue | Where-Object { $_.Publisher -match 'Sogou|搜狗' -or $_.Name -match 'pdfmenu|sogou|fastpdf|kwallpaper|kdiskmgr' };" ^
  "foreach ($p in $pkgs) { try { Remove-AppxPackage -Package $p.PackageFullName -AllUsers -ErrorAction Stop; Write-Output ('  已卸载 Appx: ' + $p.Name) } catch { Write-Output ('  Appx 卸载失败: ' + $p.Name + ' - ' + $_.Exception.Message) } };" ^
  "$prov = Get-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -match 'pdfmenu|sogou|fastpdf|kwallpaper|kdiskmgr' -or $_.Publisher -match 'Sogou|搜狗' };" ^
  "foreach ($p in $prov) { try { Remove-AppxProvisionedPackage -Online -PackageName $p.PackageName -ErrorAction Stop; Write-Output ('  已移除预装 Appx: ' + $p.DisplayName) } catch { Write-Output ('  预装 Appx 移除失败: ' + $p.DisplayName) } }" >> "%LOG%" 2>&1

:: ---------- 6. 禁用/锁定捆绑组件目录 ----------
echo [7/8] 禁用捆绑组件并锁定目录...
call :DisableBundleDir "%LOCALAPPDATA%\kdiskmgr_sogou"
call :DisableBundleDir "%LOCALAPPDATA%\kwallpaper_sogou"
call :DisableBundleDir "D:\Program Files (x86)\kwallpaper_sogou"
call :DisableBundleDir "C:\Program Files (x86)\kwallpaper_sogou"

if exist "%SOGOU_ROOT%\Components" (
    for %%D in (biz_center biz_pdf game_center kdiskmgr kwallpaper pdf_center sgzip compress) do (
        if exist "!SOGOU_ROOT!\Components\%%D" call :DisableBundleDir "!SOGOU_ROOT!\Components\%%D"
    )
    call :LockDirectory "%SOGOU_ROOT%\Components"
)
if exist "%SOGOU_ROOT_X86%\Components" (
    for %%D in (biz_center biz_pdf game_center kdiskmgr kwallpaper pdf_center sgzip compress) do (
        if exist "!SOGOU_ROOT_X86!\Components\%%D" call :DisableBundleDir "!SOGOU_ROOT_X86!\Components\%%D"
    )
    call :LockDirectory "%SOGOU_ROOT_X86%\Components"
)

:: ---------- 7. 防火墙阻止私自下载/安装 ----------
call :Log "配置防火墙出站阻止规则..."
call :AddFirewallBlock "搜狗-阻止SGTool" "%SOGOU_ROOT%\SGTool.exe"
call :AddFirewallBlock "搜狗-阻止SogouCloud" "%SOGOU_ROOT%\SogouCloud.exe"
call :AddFirewallBlock "搜狗-阻止SGDownload" "%SOGOU_ROOT%\SGDownload.exe"
call :AddFirewallBlock "搜狗-阻止SGTool(x86)" "%SOGOU_ROOT_X86%\SGTool.exe"
call :AddFirewallBlock "搜狗-阻止SogouCloud(x86)" "%SOGOU_ROOT_X86%\SogouCloud.exe"

for /r "%SOGOU_ROOT%" %%F in (SGTool.exe SogouCloud.exe SGDownload.exe SGBizHelper.exe setup.exe installer.exe) do (
    if exist "%%F" call :AddFirewallBlock "搜狗-阻止-%%~nxF" "%%F"
)
for /r "%SOGOU_ROOT_X86%" %%F in (SGTool.exe SogouCloud.exe SGDownload.exe SGBizHelper.exe setup.exe installer.exe) do (
    if exist "%%F" call :AddFirewallBlock "搜狗-阻止-x86-%%~nxF" "%%F"
)

:: 阻止 kdiskmgr / kwallpaper 可执行文件出站
for /r "%LOCALAPPDATA%" %%F in (kdiskmgr.exe KDiskMgr.exe kwallpaper.exe) do (
    if exist "%%F" call :AddFirewallBlock "搜狗-阻止-%%~nxF" "%%F"
)

:: ---------- 8. 创建登录时自动维护任务(防复发)----------
call :Log "创建登录维护任务(防复发)..."
set "MAINTAIN=%ProgramData%\SogouMenuGuard\maintain.cmd"
if not exist "%ProgramData%\SogouMenuGuard" mkdir "%ProgramData%\SogouMenuGuard" >nul 2>&1
(
    echo @echo off
    echo reg add "HKCU\Software\SogouInput\General" /v "EnableRightClickMenu" /t REG_DWORD /d 0 /f ^>nul 2^>^&1
    echo reg add "HKCU\Software\SogouInput\SearchEngine" /v "ShowContextMenu" /t REG_DWORD /d 0 /f ^>nul 2^>^&1
    echo reg add "HKCU\Software\SogouInput\Update" /v "AutoUpdate" /t REG_DWORD /d 0 /f ^>nul 2^>^&1
    echo for %%%%K in ^("HKCR\*\shellex\ContextMenuHandlers\sgshellext" "HKCR\Directory\shellex\ContextMenuHandlers\sgshellext" "HKCR\Directory\Background\shell\SogouLiXian"^) do reg delete "%%%%K" /f ^>nul 2^>^&1
) > "%MAINTAIN%"

schtasks /Delete /TN "SogouMenuGuard" /F >nul 2>&1
schtasks /Create /TN "SogouMenuGuard" /TR "cmd /c \"%MAINTAIN%\"" /SC ONLOGON /RL HIGHEST /F >nul 2>&1
if !errorlevel! equ 0 (
    call :Log "  已创建计划任务: SogouMenuGuard(每次登录自动维护)"
) else (
    call :Log "  计划任务创建失败,可手动将 %MAINTAIN% 放入启动文件夹"
    copy /Y "%MAINTAIN%" "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\SogouMenuGuard.cmd" >nul 2>&1
)

:: ---------- 重启资源管理器 ----------
echo [8/8] 重启资源管理器使更改生效...
taskkill /F /IM explorer.exe >nul 2>&1
timeout /t 2 /nobreak >nul
start explorer.exe

echo.
echo ============================================================
echo  处理完成!
echo  - 详细日志: %LOG%
echo  - 注册表备份: %BACKUP%
echo  - 维护脚本: %MAINTAIN%
echo.
echo  请右键文件/文件夹测试,确认以下项已消失:
echo    * 彻底粉碎文件
echo    * 添加到压缩文件 / 压缩相关
echo    * PDF / 打印 / 壁纸 等搜狗推广项
echo.
echo  若个别菜单仍在「显示更多选项」中,请重启电脑后再测。
echo  输入法本体未卸载,仍可正常打字。
echo ============================================================
echo 完成时间: %DATE% %TIME% >> "%LOG%"
pause
exit /b 0

:: ===================== 子程序 =====================

:DelRegKey
reg delete "%~1" /f >nul 2>&1
if !errorlevel! equ 0 call :Log "  已删除: %~1"
exit /b

:DisableBundleDir
set "TARGET=%~1"
if not exist "!TARGET!" exit /b
call :Log "  禁用目录: !TARGET!"
takeown /F "!TARGET!" /R /D Y >nul 2>&1
icacls "!TARGET!" /grant Administrators:F /T /C >nul 2>&1
icacls "!TARGET!" /grant "%USERNAME%:F" /T /C >nul 2>&1
attrib -R -S -H "!TARGET!" /S /D >nul 2>&1
set "DISABLED_NAME=DISABLED_%~nx1"
set "RENAMED=%~dp1!DISABLED_NAME!"
ren "!TARGET!" "!DISABLED_NAME!" >nul 2>&1
if !errorlevel! neq 0 (
    rd /S /Q "!TARGET!" >nul 2>&1
    if !errorlevel! equ 0 call :Log "    已直接删除: !TARGET!"
) else (
    call :Log "    已重命名为 !DISABLED_NAME!"
    call :LockDirectory "!RENAMED!"
)
exit /b

:LockDirectory
set "LOCKDIR=%~1"
if not exist "!LOCKDIR!" exit /b
call :Log "  锁定目录(拒绝写入): !LOCKDIR!"
takeown /F "!LOCKDIR!" /R /D Y >nul 2>&1
icacls "!LOCKDIR!" /inheritance:r >nul 2>&1
icacls "!LOCKDIR!" /grant Administrators:(OI)(CI)F /T /C >nul 2>&1
icacls "!LOCKDIR!" /grant "%USERNAME%:(OI)(CI)R" /T /C >nul 2>&1
icacls "!LOCKDIR!" /deny "%USERNAME%:(OI)(CI)(WD,AD,WEA,DC)" /T /C >nul 2>&1
exit /b

:AddFirewallBlock
set "RULE_NAME=%~1"
set "APP_PATH=%~2"
if not exist "!APP_PATH!" exit /b
netsh advfirewall firewall delete rule name="!RULE_NAME!" >nul 2>&1
netsh advfirewall firewall add rule name="!RULE_NAME!" dir=out action=block program="!APP_PATH!" enable=yes profile=any >nul 2>&1
if !errorlevel! equ 0 call :Log "  防火墙阻止: !APP_PATH!"
exit /b

:Log
echo %~1
echo %~1 >> "%LOG%"
exit /b
阅读量: 333