@Echo Off
Title 绿化卸载
Pushd %~dp0
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" (Set a="HKLM\SOFTWARE\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd" /v&Set b=%SystemRoot%\SysWOW64) Else (Set a="HKLM\SOFTWARE\Thunder Network\ThunderOem\thunder_backwnd" /v&Set b=%SystemRoot%\system32)
:Menu
Cls
If Exist "%b%\Tasklist.exe" Tasklist|Find /i "thunder.exe">nul&&(Echo 请先退出迅雷，按任意键重试&&Pause >nul&&Goto Menu)
If Not "%1"=="" (Set c=%1&Goto Goto)
Echo.
Echo 1.绿化
Echo.
Echo 2.卸载
Echo.
Echo 3.注册IE右键下载 ( 自选 )
Echo.
Echo +.创建桌面迷你迅雷
Echo.
:Menu
Set /p a=请输入：
If "%a%"=="1" Goto In
If "%a%"=="2" Goto Un
If "%a%"=="3" Goto RI
if "%a%"=="+" Goto Lnk
Echo.&Echo 输入无效，请重新输入！
pause >nul
Goto Menu
:In
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 "HKCR\Software\thunder" /f >nul 2>nul
Reg Delete "HKLM\Software\Thunder Network" /f >nul 2>nul
Reg Delete "HKCU\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" >nul 2>nul
Rd /s /q "%TMP%\ThunderLiveUD" >nul 2>nul
Rd /s /q "%TMP%\Thunder Network" >nul 2>nul
If Exist "%PUBLIC%" Rd /s /q "%PUBLIC%\Thunder Network" >nul 2>nul
If Exist "%PUBLIC%" Rd /s /q "%PUBLIC%\Documents\Thunder Network" >nul 2>nul
Rd /s /q "%AllUsersProfile%\Application Data\Thunder Network" >nul 2>nul
Rd /s /q "%AllUsersProfile%\Application Data\Xunlei" >nul 2>nul
Rd /s /q "%AllUsersProfile%\Xunlei" >nul 2>nul
Rd /s /q "%AllUsersProfile%\Thunder Network" >nul 2>nul
Rd /s /q "%AppData%\Thunder Network" >nul 2>nul
Rd /s /q "%CommonProgramFiles%\Thunder Network" >nul 2>nul
Rd /s /q "%CommonProgramFiles(x86)%\Thunder Network" >nul 2>nul
Rd /s /q "%UserProfile%\Local Settings\Application Data\Thunder Network" 2>NUL
Rd /s /q "%UserProfile%\Local Settings\Application Data\Pusher" 2>NUL
Rd /s /q "%UserProfile%\AppData\LocalLow\Thunder Network" >nul 2>nul
Rd /s /q "%UserProfile%\AppData\LocalLow\XueLei" >nul 2>nul
Rd /s /q "%UserProfile%\My Documents\Thunder"2>NUL
Rd /s /q "%AllUsersProfile%\Application Data\Thunder Network"2>NUL
Rd /s /q Program\SpeedHistory >nul 2>nul
Del /f /q Program\LiveUpdate_storage.xml  >nul 2>nul
Del /f /q "%AppData%\Microsoft\Windows\Libraries\迅雷下载.library-ms" 2>nul
Regsvr32 /s Bho\ThunderAgent.dll >nul 2>nul
Regsvr32 /s Bho\Platform\np_tdieplat.dll >nul 2>nul
Reg Add %a% "Path" /d "%~dp0Program\Thunder.exe" /f >nul 2>nul
Reg Add %a% "dir" /d "%~dp0\" /f >nul 2>nul
Reg Add %a% "instdir" /d "%~dp0\" /f >nul 2>nul
Reg Add %a% "Version" /d "7.99.1012.258" /f >nul 2>nul
Reg Add "HKLM\Software\Google\Chrome\NativeMessagingHosts\com.xunlei.thunder" /f /ve /d "%~dp0BHO\Chrome\com.xunlei.thunder.json" >NUL 2>nul
Md "%AllUsersProfile%\Application Data\Thunder Network\cid_store.dat"
Md "%AllUsersProfile%\Application Data\Thunder Network\emule_upload_list.dat"
Md "%AllUsersProfile%\Application Data\Thunder Network\DownloadLib\pub_store.dat"
Program\Thunder.exe -install -associate:all   >nul 2>nul
SET E=绿化完成!&GOTO MSGBOX
:RI
Reg Add "HKCU\Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载" /ve /d "%~dp0BHO\geturl.htm" /f >nul 2>nul
Reg Add "HKCU\Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载" /v "Contexts" /t REG_DWORD /d "0x00000022" >nul 2>nul
SET E=完成!&GOTO MSGBOX
:Lnk
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")
SET E=创建完成!&GOTO MSGBOX
:Un
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 "HKCR\Software\thunder" /f >nul 2>nul
Reg Delete "HKLM\Software\Thunder Network" /f >nul 2>nul
Reg Delete "HKCU\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
If Exist "%PUBLIC%" Rd /s /q "%PUBLIC%\Thunder Network" >nul 2>nul
If Exist "%PUBLIC%" Rd /s /q "%PUBLIC%\Documents\Thunder Network" >nul 2>nul
Rd /s /q "%TMP%\LiveUD" >nul 2>nul
Rd /s /q "%TMP%\Thunder" >nul 2>nul
Rd /s /q "%TMP%\Thunder Network" >nul 2>nul
Rd /s /q "%TMP%\ThunderLiveUD" >nul 2>nul
Rd /s /q "%TMP%\xltmp" >nul 2>nul
Rd /s /q "%TMP%\Xunlei" >nul 2>nul
Rd /s /q "%AllUsersProfile%\Application Data\Thunder Network" >nul 2>nul
Rd /s /q "%AllUsersProfile%\Application Data\Xunlei" >nul 2>nul
Rd /s /q "%AllUsersProfile%\Xunlei" >nul 2>nul
Rd /s /q "%AllUsersProfile%\Thunder Network" >nul 2>nul
Rd /s /q "%AppData%\Thunder Network" >nul 2>nul
Rd /s /q "%CommonProgramFiles%\Thunder Network" >nul 2>nul
If Exist "%CommonProgramFiles(x86)%" Rd /s /q "%CommonProgramFiles(x86)%\Thunder Network" >nul 2>nul
Rd /s /q "%UserProfile%\AppData\LocalLow\Thunder Network" >nul 2>nul
Rd /s /q "%UserProfile%\AppData\LocalLow\XunLei" >nul 2>nul
Rd /s /q "%UserProfile%\Local Settings\Application Data\Thunder Network" 2>NUL
Rd /s /q "%UserProfile%\Local Settings\Application Data\Pusher" 2>NUL
Rd /s /q Program\SpeedHistory >nul 2>nul
Del /f /q Program\LiveUpdate_storage.xml  >nul 2>nul
SET E=卸载完成!&GOTO MSGBOX
:MsgBox
if "%1"=="" mshta VBScript:MsgBox("%e%",vbSystemModal,"")(close)& Cls&Goto Menu
