win shell 绿化卸载实例

代码展示
0 1003

@ECHO OFF&PUSHD %~DP0 &TITLE 绿化卸载
Md "%WinDir%\System32\test_permissions" 2>NUL||(Echo.&Echo 请使用右键“以管理员身份运行”&&Pause >NUL&&Exit)
Rd "%WinDir%\System32\test_permissions" 2>NUL
SetLocal EnableDelayedExpansion

:Menu
Echo.&Echo  1.绿化
Echo.&Echo  2.卸载
Echo.&Echo  3.添加IE右键下载菜单 ( 自选 )
Echo.&Echo  4.移除IE右键下载菜单 ( 默认 )
Echo.&Echo  5.启用边下边播功能 ( 自选 )
Echo.&Echo  6.禁用边下边播功能 ( 默认 )
Echo.&Echo  7.启用谷歌浏览器扩展支持 ( 自选 )
Echo.&Echo  8.禁用谷歌浏览器扩展支持 ( 默认 )
Echo.&Echo  +.创建桌面极速迅雷快捷方式
Echo.&Echo.
set /p a=输入数字按回车:
If Not "%a%"=="" Set a=%a:~0,1%
If "%a%"=="1" Goto install
If "%a%"=="2" Goto Uninstall
If "%a%"=="3" Goto MenuExt
If "%a%"=="4" Goto DelMenuExt
If "%a%"=="5" Goto AddXmp
If "%a%"=="6" Goto DelXmp
If "%a%"=="7" Goto BhoChrome
If "%a%"=="8" Goto DBhoChrome
if "%a%"=="+" Goto DesktopLnk
Echo.&Echo 输入无效,请重新输入!
PAUSE >NUL & CLS & GOTO Menu

:install
::安装前结束相关进程并清理注册表
taskkill /f /im Thund* >NUL 2>NUL
Regedit /s Program\TdspDel.reg
Regsvr32 /s /u Bho\ThunderAgent.dll
Regsvr32 /s /u Bho\Platform\np_tdieplat.dll
Program\Thunder.exe -unassociate:td -unassociate:torrent -unassociate:downlist -unassociate:thunderskin -unassociate:thunderaddin -unassociate:all -unregprotocol:ed2k -unregprotocol:magnet -unregprotocol:thunder -unregprotocol:xlapplink
Reg Delete "HKCR\Xunlei.Bittorrent.6" /f >nul 2>nul
Reg Delete "HKCR\Xunlei.LSTFile.6" /f >nul 2>nul
Reg Delete "HKCR\Xunlei.TDFile.6" /f >nul 2>nul
Reg Delete "HKCR\Xunlei.ThunderSkin.6" /f >nul 2>nul
Reg Delete "HKCU\Software\Thunder Network" /f >nul 2>nul
Reg Delete "HKLM\Software\Thunder Network" /f >nul 2>nul
Reg Delete "HKLM\Software\Wow6432Node\Thunder Network" /f >nul 2>nul
Reg Delete "HKLM\Software\Google\Chrome\NativeMessagingHosts" /f >nul 2>nul
Reg Delete "HKCU\Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载" /f >nul 2>nul
Reg Delete "HKCU\Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载全部链接" /f >nul 2>nul
Reg Delete "HKCU\Software\Microsoft\Internet Explorer\MenuExt\使用迅雷离线下载" /f >nul 2>nul

::清理后台相关残留数据为安装做准备
Rd /s /q "%TMP%\Xunlei" >nul 2>nul
Rd /s /q "%TMP%\Thunder Network" >nul 2>nul
Rd /s /q "Program\SpeedHistory" >nul 2>nul
If Exist "%PUBLIC%" Rd /s /q "%PUBLIC%\Thunder Network" >nul 2>nul
Del /f /q "%AppData%\Microsoft\Windows\Libraries\迅雷下载.library-ms" 2>nul
Rd /s /q "%AllUsersProfile%\Application Data\Thunder Network" >nul 2>nul
Rd /s /q "%UserProfile%\Local Settings\Application Data\Thunder Network" 2>NUL
Rd /s /q "%UserProfile%\AppData\LocalLow\Thunder Network" >nul 2>nul

::开始安装(注册浏览器插件、创建基本关联)
Regsvr32 /s Bho\ThunderAgent.dll
Regsvr32 /s Bho\Platform\np_tdieplat.dll >nul 2>nul
Program\Thunder.exe -install -associate:all   >nul 2>nul
Reg Add HKCR\Xunlei.Bittorrent.6\DefaultIcon /ve /d "%~dp0Program\TorrentFile.ico" /F>NUL
Reg Add HKCR\Xunlei.Bittorrent.6\Shell\Open /ve /d "使用迅雷下载该BT文件" /F>NUL
Reg Add HKCR\Xunlei.Bittorrent.6\Shell\Open\command /ve /d "%~dp0Program\Thunder.exe %%1" /F>NUL
Reg Add HKCR\Xunlei.LSTFile.6\DefaultIcon /ve /d "%~dp0Program\XLDownloadList.ico" /F>NUL
Reg Add HKCR\Xunlei.LSTFile.6\Shell\Open /ve /d "使用迅雷下载该任务列表文件" /F>NUL
Reg Add HKCR\Xunlei.LSTFile.6\Shell\Open\command /ve /d "%~dp0Program\Thunder.exe %%1" /F>NUL
Reg Add HKCR\Xunlei.TDFile.6\DefaultIcon /ve /d "%~dp0Program\XLTempFile.ico" /F>NUL
Reg Add HKCR\Xunlei.TDFile.6\Shell\Open /ve /d "使用迅雷下载未完成文件" /F>NUL
Reg Add HKCR\Xunlei.TDFile.6\Shell\Open\command /ve /d "%~dp0Program\Thunder.exe %%1" /F>NUL

if "%PROCESSOR_ARCHITECTURE%"=="x86" Reg Add "HKLM\Software\Thunder Network\ThunderOem\thunder_backwnd" /v dir /d "%~dp0" >nul 2>nul
if "%PROCESSOR_ARCHITECTURE%"=="x86" Reg Add "HKLM\Software\Thunder Network\ThunderOem\thunder_backwnd" /v Path /d "%~dp0Program\Thunder.exe" >NUL 2>nul 
if "%PROCESSOR_ARCHITECTURE%"=="x86" Reg Add "HKLM\Software\Thunder Network\ThunderOem\thunder_backwnd" /v instdir /d "%~dp0" >nul 2>nul
if "%PROCESSOR_ARCHITECTURE%"=="x86" Reg Add "HKLM\Software\Thunder Network\ThunderOem\thunder_backwnd" /v Version /d "7.10.34.360" >nul 2>nul
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" Reg Add "HKLM\Software\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd" /v dir /d "%~dp0" >nul 2>nul
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" Reg Add "HKLM\Software\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd" /v Path /d "%~dp0Program\Thunder.exe" >NUL 2>nul
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" Reg Add "HKLM\Software\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd" /v instdir /d "%~dp0" >nul 2>nul
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" Reg Add "HKLM\Software\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd" /v Version /d "7.10.34.360" >nul 2>nul
Echo.&Echo 绿化完成,按任意键返回!&PAUSE >NUL 2>NUL & CLS & GOTO MENU

::添加/移除IE右键菜单 (默认不添加)
:MenuExt
Reg Add "HKCU\Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载" /ve /d "%~dp0BHO\geturl.htm" /f >nul
Reg Add "HKCU\Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载" /v "Contexts" /t REG_DWORD /d "0x00000022" /f >nul
Reg Add "HKCU\Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载全部链接" /ve /d "%~dp0BHO\getAllurl.htm" /f >nul
Reg Add "HKCU\Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载全部链接" /v "Contexts" /t REG_DWORD /d "0x000000f3" /f >nul
Echo.&Echo IE右键下载菜单已添加,按任意键返回!&PAUSE >NUL 2>NUL & CLS & GOTO MENU

:DelMenuExt
Reg Delete "HKCU\Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载" /f >nul 2>nul
Reg Delete "HKCU\Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载全部链接" /f >nul 2>nul
Echo.&Echo IE右键下载菜单已移除,按任意键返回!&PAUSE >NUL 2>NUL & CLS & GOTO MENU

::边下边播启用/禁用开关(只支持POT,默认不启用) 
::其实并没什么卵用,还不如直接下载...
:AddXmp
taskkill /f /im Thunder* >NUL 2>NUL
ren Program\stream.dl_ stream.dll >NUL 2>NUL
start Program\Xmp.ini
CLS & GOTO MENU

:DelXmp
taskkill /f /im Thunder* >NUL 2>NUL
ren Program\stream.dll stream.dl_ >NUL 2>NUL
Regedit /s Program\TdspDel.reg
Echo.&Echo 已禁用边下边播,按任意键返回!&PAUSE >NUL 2>NUL & CLS & GOTO MENU

::谷歌浏览器扩展支持(默认不启用)
:BhoChrome
Reg Add "HKLM\Software\Google\Chrome\NativeMessagingHosts\com.xunlei.thunder" /f /ve /d "%~dp0Bho\Chrome\com.xunlei.thunder.json" >NUL 2>nul
Echo.&Echo 已启用扩展支持,您需从谷歌网上应用店安装官方扩展,方可正常使用!
Echo.&Echo 如已安装官方扩展,可忽略上述提示,按任意键返回!&PAUSE >NUL 2>NUL & CLS & GOTO MENU

:DBhoChrome
Reg Delete "HKLM\Software\Google\Chrome\NativeMessagingHosts" /f >nul 2>nul
Echo.&Echo 已禁用扩展支持,按任意键返回!&PAUSE >NUL 2>NUL & CLS & GOTO MENU

:DesktopLnk
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\极速迅雷.lnk""):b.TargetPath=""%~dp0Program\Thunder.exe"":b.WorkingDirectory=""%~dp0Program\"":b.Save:close")
Echo.&Echo 已创建桌面快捷方式,按任意键返回!&PAUSE >NUL 2>NUL & CLS & GOTO MENU

:Uninstall
taskkill /f /im Thund* >NUL 2>NUL
Regedit /s Program\TdspDel.reg
Regsvr32 /s /u Bho\ThunderAgent.dll
Regsvr32 /s /u Bho\Platform\np_tdieplat.dll
Program\Thunder.exe -unassociate:td -unassociate:torrent -unassociate:downlist -unassociate:thunderskin -unassociate:thunderaddin -unassociate:all -unregprotocol:ed2k -unregprotocol:magnet -unregprotocol:thunder -unregprotocol:xlapplink
Reg Delete "HKCR\Xunlei.Bittorrent.6" /f >nul 2>nul
Reg Delete "HKCR\Xunlei.LSTFile.6" /f >nul 2>nul
Reg Delete "HKCR\Xunlei.TDFile.6" /f >nul 2>nul
Reg Delete "HKCR\Xunlei.ThunderSkin.6" /f >nul 2>nul
Reg Delete "HKCU\Software\Thunder Network" /f >nul 2>nul
Reg Delete "HKLM\Software\Thunder Network" /f >nul 2>nul
Reg Delete "HKLM\Software\Wow6432Node\Thunder Network" /f >nul 2>nul
Reg Delete "HKLM\Software\Google\Chrome\NativeMessagingHosts" /f >nul 2>nul
Reg Delete "HKCU\Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载" /f >nul 2>nul
Reg Delete "HKCU\Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载全部链接" /f >nul 2>nul

Rd /s /q "%TMP%\Xunlei" >nul 2>nul
Rd /s /q "%TMP%\Thunder Network" >nul 2>nul
Rd /s /q "Program\SpeedHistory" >nul 2>nul
If Exist "%PUBLIC%" Rd /s /q "%PUBLIC%\Thunder Network" >nul 2>nul
Del /f /q "%AppData%\Microsoft\Windows\Libraries\迅雷下载.library-ms" 2>nul
Rd /s /q "%AllUsersProfile%\Application Data\Thunder Network" >nul 2>nul
Rd /s /q "%UserProfile%\Local Settings\Application Data\Thunder Network" 2>NUL
Rd /s /q "%UserProfile%\AppData\LocalLow\Thunder Network" >nul 2>nul
Echo.&Echo 已卸载完成,按任意键返回!&PAUSE >NUL 2>NUL & CLS & GOTO MENU