@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 QQLive* >NUL 2>NUL

rd/s/q "%AppData%\Tencent\QQLive\LiveUp"2>NUL
rd/s/q "%AppData%\Tencent\QQLive\MiniTips"2>NUL
rd/s/q "%AppData%\Tencent\QQLive\CacheFile\AD"2>NUL
del/f "%AppData%\Tencent\QQLive\AutoUpdate.conf" >NUL 2>NUL
del/f "%AppData%\Tencent\QQLive\CacheFile\TencentVideo*" >NUL 2>NUL
del/f "%AppData%\Tencent\QQLive\CacheFile\AutoUpdate.conf" >NUL 2>NUL
del/f "%AppData%\Tencent\QQLive\CacheFile\checkupdate.tmp" >NUL 2>NUL

regsvr32 /s LiveAPI.dll
regsvr32 /s LiveLogin.dll
start /wait /B "" "%~dp0QQLive.exe" -register
start /wait /B "" "%~dp0QQLive.exe" -reg_video_file
start /wait /B "" "%~dp0QQLive.exe" -cacl
start /wait /B "" "%~dp0QQLive.exe" -WriteCookie
start /wait /B "" "%~dp0QQLive.exe" -PreLoadPlayerModule
regsvr32 /s npQQLive.dll
regsvr32 /s LiveOcx.dll
if exist "%Public%" start /wait /B "" "%~dp0OcxHelper.exe" -drm_path "%ProgramData%\Tencent\QQLive\"
if not exist "%Public%" start /wait /B "" "%~dp0OcxHelper.exe" -drm_path "%AllUsersProfile%\Application Data\Tencent\QQLive\"
start /wait /B "" "%~dp0OcxHelper.exe" -fix_reg -install
start /wait /B "" "%~dp0OcxHelper.exe" -install

reg add HKCR\qqtv /f /v install /d "%CD%" >NUL
reg add HKCR\qqtv /f /v installPath /d "%CD%" >NUL

if "%PROCESSOR_ARCHITECTURE%"=="x86" reg add HKLM\Software\tencent\qqlive /f /v install /d "%~dp0\" >NUL
if "%PROCESSOR_ARCHITECTURE%"=="x86" reg add HKLM\Software\tencent\qqliveocx /f /v install /d "%~dp0\" >NUL
if "%PROCESSOR_ARCHITECTURE%"=="x86" reg add HKLM\Software\tencent\qqlive /f /v short_instal /d "%~dp0\" >NUL

If "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg add HKLM\Software\Wow6432Node\tencent\qqlive /f /v install /d "%~dp0\" >NUL
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg add HKLM\Software\Wow6432Node\tencent\qqliveocx /f /v install /d "%~dp0\" >NUL
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg add HKLM\Software\Wow6432Node\tencent\qqlive /f /v short_instal /d "%~dp0\" >NUL

CLS && ECHO.&ECHO.完成! 是否创建桌面快捷方式？
ECHO.&ECHO.是请按任意键，否就直接关闭！&PAUSE >NUL 2>NUL

mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\腾讯视频.lnk""):b.TargetPath=""%~dp0QQLive.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")

CLS&ECHO.&ECHO.创建完成! &PAUSE >NUL 2>NUL&EXIT