@ECHO OFF & CD /D %~DP0 & TITLE 卸载
>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
)

taskkill /f /im Thunder* >NUL 2>NUL
taskkill /f /im XLLiveUD* >NUL 2>NUL
taskkill /f /im xlbrowsershell*  >NUL 2>NUL
taskkill /f /im DownloadSDKServer* >NUL 2>NUL

regsvr32 /s /u BHO\ThunderAgent.dll
regsvr32 /s /u BHO\ThunderAgent64.dll
regsvr32 /s /u BHO\Platform\np_tdieplat.dll
Program\Thunder.exe -unassociate:all -unregprotocol:all

del  "Program\stat.dat" >NUL  2>NUL 
del  "Program\latest_thunder_stat.xml" >NUL  2>NUL 
del  "Program\resources\bin\TBC\xlbrowser.ini" >NUL  2>NUL 
rd/s/q "Program\resources\bin\TBC\Data"2>NUL
del/q "BHO\ThunderAgent*.*.*.dll" >NUL  2>NUL 

rd/s/q "%tmp%\Xmp"2>NUL
rd/s/q "%tmp%\Xunlei"2>NUL
rd/s/q "%tmp%\Thunder"2>NUL
rd/s/q "%tmp%\XLLiveUD"2>NUL
rd/s/q "%tmp%\ThunderLiveUD"2>NUL
rd/s/q "%tmp%\Thunder Network"2>NUL
rd/s/q "%AppData%\thunderx"2>NUL
rd/s/q "%AppData%\Thunder Network"2>NUL
rd/s/q "%ProgramData%\Thunder Network"2>NUL
del "%UserProfile%\AppData\APlayerCodecs3.exe" >NUL 2>NUL
del "%AllUsersProfile%\Application Data\APlayerCodecs3.exe" >NUL 2>NUL
del/f/q "%AppData%\Microsoft\Windows\Libraries\迅雷下载.library-ms" >NUL 2>NUL
rd/s/q "%AllUsersProfile%\Xunlei"2>NUL
rd/s/q "%AllUsersProfile%\Thunder Network"2>NUL
rd/s/q "%AllUsersProfile%\Application Data\Xunlei"2>NUL
rd/s/q "%AllUsersProfile%\Application Data\Thunder Network"2>NUL
rd/s/q "%CommonProgramFiles%\Thunder Network"2>NUL
rd/s/q "%CommonProgramFiles(x86)%\Thunder Network"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%\My Documents\Thunder"2>NUL
rd/s/q "%UserProfile%\AppData\Roaming\迅雷" 2>NUL
rd/s/q "%UserProfile%\AppData\Roaming\迅雷X" 2>NUL
rd/s/q "%UserProfile%\AppData\Roaming\thunderx"2>NUL
rd/s/q "%UserProfile%\AppData\Roaming\XLGameBox"2>NUL
rd/s/q "%UserProfile%\AppData\LocalLow\XunLei"2>NUL
rd/s/q "%UserProfile%\AppData\LocalLow\XunleiBHO"2>NUL
rd/s/q "%UserProfile%\AppData\LocalLow\Thunder Network"2>NUL
rd/s/q "%AllUsersProfile%\Application Data\Thunder Network"2>NUL
If exist "%PUBLIC%" rd/s/q "%PUBLIC%\Thunder Network"2>NUL
If exist "%PUBLIC%" rd/s/q "%PUBLIC%\Documents\Thunder Network"2>NUL
rd/s/q "%PUBLIC%\Thunder Network\cid_store.dat" 2>NUL
rd/s/q  "%PUBLIC%\Thunder Network\tp_common_info.dat" 2>NUL
rd/s/q  "%PUBLIC%\Thunder Network\emule_upload_list.dat" 2>NUL
rd/s/q "%AllUsersProfile%\Application Data\Thunder Network\cid_store.dat" >NUL 2>NUL
rd/s/q "%AllUsersProfile%\Application Data\Thunder Network\tp_common_info.dat" 2>NUL
rd/s/q "%AllUsersProfile%\Application Data\Thunder Network\emule_upload_list.dat" >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\Xunlei.LSTFile.6" /f >NUL 2>NUL
reg delete "HKCR\Xunlei.Bittorrent.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 "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\MozillaPlugins\@xunlei.com" /f >NUL 2>NUL
reg delete "HKLM\Software\MozillaPlugins\@xunlei.com" /f >NUL 2>NUL
reg delete "HKCU\Software\Google\Chrome\NativeMessagingHosts" /f >NUL 2>NUL
reg delete "HKLM\Software\Google\Chrome\NativeMessagingHosts" /f >NUL 2>NUL
reg delete "HKLM\Software\Wow6432Node\MozillaPlugins\@xunlei.com" /f >NUL 2>NUL
reg delete "HKLM\Software\Wow6432Node\Google\Chrome\NativeMessagingHosts" /f >NUL 2>NUL

del  "Thunder.lnk " >NUL 2>NUL
del  "%userprofile%\桌面\迅雷X.lnk"  >NUL 2>NUL
del  "%userprofile%\Desktop\迅雷X.lnk" >NUL 2>NUL
taskkill /f /im explorer* >NUL 2>NUL  & start explorer
ECHO. &ECHO 卸载完成！&PAUSE >NUL 2>NUL & EXIT