@ECHO OFF&PUSHD %~DP0 &TITLE 绿化 
:: 自动强制结束相关进程
taskkill /f /im PPL* >NUL 2>NUL
taskkill /f /im PPA* >NUL 2>NUL
:: 清理后台临时数据和广告
rd/s/q "%Appdata%\PPLive" 2>NUL
rd/s/q "%ProgramData%\PPLive"2>NUL
rd/s/q "%Public%\Documents\PPTV"2>NUL
rd/s/q "%UserProfile%\Documents\PPTV" 2>NUL
rd/s/q "%UserProfile%\My Documents\PPTV"2>NUL
reg delete HKCU\Software\PPLive /F >NUL 2>NUL
rd/s/q "%CommonProgramFiles%\PPLiveNetwork"2>NUL
rd/s/q "%CommonProgramFiles(x86)%\PPLiveNetwork"2>NUL
rd/s/q "%AllUsersProfile%\Application Data\PPLive"2>NUL
rd/s/q "%UserProfile%\Local Settings\Application Data\PPLive"2>NUL
del/f/q "%AppData%\Microsoft\Windows\Libraries\PPTV视频.library-ms">NUL 2>NUL
:: 设置默认关闭完全退出程序
reg add HKCU\Software\PPLive\Config\Other /v CloseAction /t REG_DWORD /d 0 /F>NUL
:: 释放核心组件到程序公用库
if not exist "%WinDir%\SysWOW64" xcopy /e/c/i/y Components\PPLiveNetwork "%CommonProgramfiles%\PPLiveNetwork" >NUL 2>NUL
if exist "%WinDir%\SysWOW64" xcopy /e/c/i/y Components\PPLiveNetwork "%CommonProgramFiles(x86)%\PPLiveNetwork">NUL 2>NUL
:: 判断是否为Win7/8,属性增加兼容模式,更好的兼容程序.
::if exist "%Public%" reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "%~dp0PPLive.exe" /d WinXPSP3 /F>NUL
:Menu
echo.&echo +.创建桌面PPTV网络电视
echo.&echo 1.屏蔽节目库悬浮层广告
echo.
set /p a=输入回车：
if "%a%"=="+" Goto DesktopLnk
if "%a%"=="1" Goto KillWebKitAD
:KillWebKitAD
attrib -h -r "%Windir%\System32\Drivers\etc\hosts" >NUL 2>NUL
echo.PPTV.Kill.WebKit.AD >>%WinDir%\System32\drivers\etc\hosts 2>NUL
echo.8.0.0.0 pp2.pptv.com >>%WinDir%\System32\drivers\etc\hosts 2>NUL
echo.8.0.0.0 wafp.pptv.com >>%WinDir%\System32\drivers\etc\hosts 2>NUL
echo.8.0.0.0 jp.as.pptv.com >>%WinDir%\System32\drivers\etc\hosts 2>NUL
echo.8.0.0.0 de.as.pptv.com >>%WinDir%\System32\drivers\etc\hosts 2>NUL
echo.8.0.0.0 ik.synacast.com >>%WinDir%\System32\drivers\etc\hosts 2>NUL
echo.8.0.0.0 asimgs.pplive.cn >>%WinDir%\System32\drivers\etc\hosts 2>NUL
echo.8.0.0.0 comment.pptv.com >>%WinDir%\System32\drivers\etc\hosts 2>NUL
echo.8.0.0.0 static.g.pptv.com >>%WinDir%\System32\drivers\etc\hosts 2>NUL
echo.8.0.0.0 as.aplus.pptv.com >>%WinDir%\System32\drivers\etc\hosts 2>NUL
echo.8.0.0.0 g.cn.miaozhen.com >>%WinDir%\System32\drivers\etc\hosts 2>NUL
echo.8.0.0.0 vas.aplus.pptv.com >>%WinDir%\System32\drivers\etc\hosts 2>NUL
echo.8.0.0.0 tips.passport.pptv.com >>%WinDir%\System32\drivers\etc\hosts 2>NUL
SET E=完成!&GOTO MSGBOX
:DesktopLnk
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\PPTV网络电视.lnk""):b.TargetPath=""%~dp0PPLive.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")&SET E=完成!&GOTO MSGBOX
:MsgBox
if "%1"=="" mshta VBScript:MsgBox("%e%",vbSystemModal,"")(close)& Cls&Goto Menu