@ECHO OFF&PUSHD %~DP0 &TITLE 绿化卸载(小俊修改)
mode con cols=45 lines=33
color 2F
>NUL 2>&1 REG.exe query "HKU\S-1-5-19" || (
    ECHO SET UAC = CreateObject^("Shell.Application"^) > "%TEMP%\Getadmin.vbs"
    ECHO UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%TEMP%\Getadmin.vbs"
    "%TEMP%\Getadmin.vbs"
    DEL /f /q "%TEMP%\Getadmin.vbs" 2>NUL
    Exit /b
)
:Menu
Cls
@ echo.
@ echo.  菜单选项：
@ echo.
@ echo.   1.绿化[必须]
@ echo.
@ echo.   2.创建桌面图标
@ echo.
@ echo.   3.开启或关闭本地会员[默认开启本地会员]
@ echo.  
@ echo.   4.开启或关闭边下边播[默认关闭边下边播]
@ echo. 
@ echo.   5.卸载
@ echo. 
@ echo. 进入设置需最大化窗口
@ echo. 
@ echo. 打开软件提示“应用程序无法启动，因为应用程序的并行配置不正确。。。”等字样，请安装运行库，谢谢
@ echo. 
@ echo. 开启边下边播功能后，请查看!迅雷影音组件(如需边下边播功能,请勿删除此文档).txt，完成整个组件安装
@ echo. 
set /p xj= 输入数字按回车：
if /i "%xj%"=="1" Goto Install
if /i "%xj%"=="2" Goto Establish
if /i "%xj%"=="3" Goto If VIP
if /i "%xj%"=="4" Goto DownloadAndPlay
if /i "%xj%"=="5" Goto Uninstall
@ echo.
echo 　　    选择无效...请重新输入...
ping -n 2 127.1>nul
goto menu
:Install
:: 安装前结束相关进程
@ echo.
echo  正在结束相关进程  
taskkill /f /im Thunder*>nul 2>nul
@ echo.
echo  正在绿化中，请稍等
::清理优化相关数据
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
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
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
del/f/q "%AppData%\Microsoft\Windows\Libraries\迅雷下载.library-ms" 2>nul
Md "%AllUsersProfile%\Application Data\Thunder Network\tp_common_info.dat"
if %errorlevel%==0 Md  "%PUBLIC%\Thunder Network\tp_common_info.dat"
regsvr32 /s "BHO\UserAgent.dll" >nul 2>nul
regsvr32 /s "Program\np_tdieplat.dll" >nul 2>nul
regsvr32 /s "BHO\ThunderAgent.dll" >nul 2>nul
if exist "%WinDir%\SysWOW64" Regsvr32 /s "BHO\ThunderAgent64.dll" >nul 2>nul
reg delete "HKCU\Software\Thunder Network" /f >nul 2>nul
Md "%AllUsersProfile%\Application Data\Thunder Network\cid_store.dat"
Md "%AllUsersProfile%\Application Data\Thunder Network\emule_upload_list.dat"
if %errorlevel%==0 (Md "%PUBLIC%\Thunder Network\cid_store.dat"&Md "%PUBLIC%\Thunder Network\emule_upload_list.dat")
if not exist "%WinDir%\SysWOW64" reg add "HKLM\Software\Thunder Network\ThunderOem\thunder_backwnd" /v "dir" /d "%~dp0\" /f >nul 2>nul
if not exist "%WinDir%\SysWOW64" reg add "HKLM\Software\Thunder Network\ThunderOem\thunder_backwnd" /v "Path" /d "%~dp0Program\Thunder.exe" /f >nul 2>nul
if not exist "%WinDir%\SysWOW64" reg add "HKLM\Software\Thunder Network\ThunderOem\thunder_backwnd" /v "instdir" /d "%~dp0\" /f >nul 2>nul
if not exist "%WinDir%\SysWOW64" reg add "HKLM\Software\Thunder Network\ThunderOem\thunder_backwnd" /v "Version" /d "10.0.2.60" /f >nul 2>nul
if exist "%WinDir%\SysWOW64" reg add "HKLM\Software\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd" /v "dir" /d "%~dp0\" /f >nul 2>nul
if exist "%WinDir%\SysWOW64" reg add "HKLM\Software\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd" /v "Path" /d "%~dp0Program\Thunder.exe" /f >nul 2>nul
if exist "%WinDir%\SysWOW64" reg add "HKLM\Software\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd" /v "instdir" /d "%~dp0\" /f >nul 2>nul
if exist "%WinDir%\SysWOW64" reg add "HKLM\Software\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd" /v "Version" /d "10.0.2.60" /f >nul 2>nul
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
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
reg add "HKCR\.xltd" /ve /d "Xunlei.TDFile.6" /F>nul
reg add "HKCR\.torrent" /ve /d "Xunlei.Bittorrent.6" /F>nul
reg add "HKCR\.downlist" /ve /d "Xunlei.LSTFile.6" /F>nul
reg Add "HKLM\Software\Google\Chrome\NativeMessagingHosts\com.xunlei.thunder" /f /ve /d "%~dp0Program\com.xunlei.thunder.json" >NUL 2>nul
if not exist "%WinDir%\SysWOW64" reg Add "HKLM\SOFTWARE\MozillaPlugins\@xunlei.com/npxunlei;version=1.0.0.2" /v "path" /d "%~dp0Data\npxunlei1.0.0.2.dll" /f >nul 2>nul
if exist "%WinDir%\SysWOW64" reg Add "HKLM\SOFTWARE\Wow6432Node\MozillaPlugins\@xunlei.com/npxunlei;version=1.0.0.2" /v "Path" /d "%~dp0Data\npxunlei1.0.0.2.dll" /f >nul 2>nul
@ echo.
echo  绿化完成，请尽情使用吧
ping -n 2 140.1>nul
goto menu
:Establish
@ echo.
echo  正在创建桌面图标，请稍等
ping -n 2 127.1>nul
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  已创建桌面图标，请尽情使用吧 
ping -n 2 140.1>nul
goto menu
:If VIP
:: 切换前结束相关进程
@ echo.
echo  正在结束相关进程
taskkill /f /im Thunder*>nul 2>nul
if exist "Thunder\Xar\ThunderApp\BaseCommunity.close.xar" (
@ echo.
echo  正在关闭本地会员，请稍等
ren Program\XLAccount.dll  XLAccount.open.dll
ren Thunder\Xar\ThunderApp\BaseCommunity.xar  BaseCommunity.open.xar
ren Program\XLAccount.close.dll  XLAccount.dll
ren Thunder\Xar\ThunderApp\BaseCommunity.close.xar  BaseCommunity.xar
@ echo.
echo  已关闭本地会员，请尽情使用吧
ping -n 2 140.1>nul
) else (
@ echo.
echo  正在开启本地会员，请稍等
ren Program\XLAccount.dll  XLAccount.close.dll
ren Thunder\Xar\ThunderApp\BaseCommunity.xar  BaseCommunity.close.xar
ren Program\XLAccount.open.dll  XLAccount.dll
ren Thunder\Xar\ThunderApp\BaseCommunity.open.xar  BaseCommunity.xar
@ echo.
echo  已开启本地会员，请尽情使用吧
ping -n 2 140.1>nul
)
goto menu
:DownloadAndPlay
:: 切换前结束相关进程
@ echo.
echo  正在结束相关进程　  
taskkill /f /im Thunder*>nul 2>nul
if exist "Thunder\Xar\ThunderApp\DownloadAndPlay.close.xar" (
@ echo.
echo  正在开启边下边播功能，请稍等
ren Thunder\Xar\ThunderApp\DownloadAndPlay.close.xar  DownloadAndPlay.xar

@ echo.
echo  已开启边下边播功能，请尽情使用吧 
ping -n 2 140.1>nul
) else (
@ echo.
echo  正在关闭边下边播功能，请稍等
ren Thunder\Xar\ThunderApp\DownloadAndPlay.xar  DownloadAndPlay.close.xar
@ echo.
echo  已关闭边下边播功能，请尽情使用吧
ping -n 2 140.1>nul
)
goto menu
:Uninstall
:: 安装前结束相关进程
@ echo.
echo  正在结束相关进程  
taskkill /f /im Thunder*>nul 2>nul
@ echo.
echo  正在卸载中，请稍等
::清理优化相关数据
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
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
del/f/q "%AppData%\Microsoft\Windows\Libraries\迅雷下载.library-ms" 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
regsvr32 /s /u "Program\np_tdieplat.dll" >nul 2>nul
regsvr32 /s /u "BHO\ThunderAgent.dll" >nul 2>nul
regsvr32 /s /u "BHO\ThunderAgent10.0.2.60.dll" >nul 2>nul
if exist "%WinDir%\SysWOW64" Regsvr32 /s /u "BHO\ThunderAgent64.dll" >nul 2>nul
if exist "%WinDir%\SysWOW64" Regsvr32 /s /u "BHO\ThunderAgent6410.0.2.60.dll" >nul 2>nul
del/f/q "BHO\ThunderAgent10.0.2.60.dll" 2>nul
if exist "%WinDir%\SysWOW64" del/f/q "BHO\ThunderAgent6410.0.2.60.dll" 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 "HKLM\Software\Wow6432Node\Google\Chrome\NativeMessagingHosts" /f >nul 2>nul
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\xlapp" /f >nul 2>nul
reg delete "HKCR\xlb" /f >nul 2>nul
reg delete "HKCR\.xltd" /f >nul 2>nul
reg delete "HKCR\.torrent" /f >nul 2>nul
reg delete "HKCR\.downlist" /f >nul 2>nul
reg delete "HKCR\.xlb" /f >nul 2>nul
reg delete "HKCR\.thunderskin" /f >nul 2>nul
reg delete "HKLM\Software\Classes\Xunlei.Bittorrent.6" /f >nul 2>nul
reg delete "HKLM\Software\Classes\Xunlei.LSTFile.6" /f >nul 2>nul
reg delete "HKLM\Software\Classes\Xunlei.TDFile.6" /f >nul 2>nul
reg delete "HKLM\Software\Classes\Xunlei.ThunderSkin.6" /f >nul 2>nul
reg delete "HKLM\Software\Classes\Xunlei.XLB.6" /f >nul 2>nul
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.xltd" /f >nul 2>nul
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.torrent" /f >nul 2>nul
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.xlb" /f >nul 2>nul
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.downlist" /f >nul 2>nul
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.thunderskin" /f >nul 2>nul
reg delete "HKCU\Software\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 "HKLM\SOFTWARE\MozillaPlugins\@xunlei.com/npxunlei;version=1.0.0.2" /f >nul 2>nul
reg delete "HKLM\SOFTWARE\Wow6432Node\MozillaPlugins\@xunlei.com/npxunlei;version=1.0.0.2" /f >nul 2>nul
del /f /q "%userprofile%"\Desktop\迅雷.lnk /f >nul 2>nul
del /f /q "%userprofile%"\桌面\迅雷.lnk /f >nul 2>nul
@ echo.
echo  卸载完成，欢迎再次使用
ping -n 2 140.1>nul
goto menu