@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
)
:: 卸载前结束相关进程
@ echo.
echo  正在结束相关进程
taskkill /f /im QQLive.exe >NUL 2>NUL
@ echo.
echo  正在卸载中，请稍后
::清理相关数据
:: 清理后台相关文件及注册残留
rd/s/q "%APPDATA%\Tencent\DeskUpdate"2>NUL
rd/s/q "%APPDATA%\Tencent\Logs"  2>NUL
rd/s/q "%APPDATA%\Tencent\OMGCACHE"  2>NUL
rd/s/q "%AppData%\Tencent\QQLive"  2>NUL
::卸载所有控件
regsvr32 /s /u LiveOcx.dll
regsvr32 /s /u LiveAPI.dll
regsvr32 /s /u LiveLogin.dll
regsvr32 /s /u npQQLive.dll
start /wait /B "" "%~dp0QQLive.exe" -DelCookie
start /wait /B "" "%~dp0QQLive.exe" -clear_p2p_cache
start /wait /B "" "%~dp0QQLive.exe" -clear_sso_config
start /wait /B "" "%~dp0QQLive.exe" -unreg_video_file
start /wait /B "" "%~dp0QQLive.exe" -unregister
::删除注册表键值
reg delete HKCR\qqtv /f>NUL 2>NUL
reg delete HKLM\Software\tencent\qqlive /f>NUL 2>NUL
reg delete HKCU\Software\tencent\qqlive /f>NUL 2>NUL
reg delete HKLM\Software\Wow6432Node\tencent\qqlive /f>NUL 2>NUL
reg delete HKLM\Software\Microsoft\MediaPlayer\MediaPlugins\DSPConfig /f>NUL 2>NUL
::删除桌面图标(只支持系统默认桌面位置)
del /q "%userprofile%\Desktop\腾讯视频.lnk" >NUL  2>NUL 
del /q "%userprofile%\桌面\腾讯视频.lnk" >NUL  2>NUL 
CLS && ECHO.&ECHO 卸载完成，按任意键退出！ &&PAUSE>NUL  & EXIT