@ECHO OFF&(PUSHD "%~DP0")&(REG QUERY "HKU\S-1-5-19">NUL 2>&1)||(
powershell -Command "Start-Process '%~sdpnx0' -Verb RunAs"&&EXIT)

taskkill /f /im IQIYIsetup.exe >NUL 2>NUL
taskkill /f /im QyUpdate.exe >NUL 2>NUL
taskkill /f /im QiyiService.exe >NUL 2>NUL
taskkill /f /im QyClient.exe >NUL 2>NUL
taskkill /f /im QyKernel.exe >NUL 2>NUL
taskkill /f /im QyFragment.exe >NUL 2>NUL
taskkill /f /im QyPlayer.exe >NUL 2>NUL
ping 127.0.1 /n 1 >NUL 2>NUL
taskkill /f /im TRACERT.exe >NUL 2>NUL
taskkill /f /im QyClient.exe >NUL 2>NUL
taskkill /f /im QyKernel.exe >NUL 2>NUL
taskkill /f /im QyFragment.exe >NUL 2>NUL
ping 127.0.1 /n 1 >NUL 2>NUL
taskkill /f /im QIYIClient.exe >NUL 2>NUL
taskkill /f /im rundll32.exe /t >NUL 2>NUL

::移除服务防火墙规则开机启动项
net stop QiyiService >NUL 2>NUL & sc delete QiyiService >NUL 2>NUL
reg delete "HKLM\SYSTEM\CurrentControlSet\Services\QiyiService" /f >NUL 2>NUL
netsh advfirewall firewall delete rule name="爱奇艺视频客户端" dir=in program="%~dp0QyClient.exe" >NUL 2>NUL
netsh advfirewall firewall delete rule name="IQIYI Video Helper" dir=in program="%~dp0QyKernel.exe" >NUL 2>NUL
netsh advfirewall firewall delete rule name="爱奇艺视频播放器组件" dir=in program="%~dp0QyPlayer.exe" >NUL 2>NUL
netsh advfirewall firewall delete rule name="爱奇艺视频辅助程序" dir=in program="%~dp0QyFragment.exe" >NUL 2>NUL

reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f /v "QyClient" >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f /v "QyClient" >NUL 2>NUL
reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f /v "HCDNClient" >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f /v "HCDNClient" >NUL 2>NUL
reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f /v "QyFragment" >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f /v "QyFragment" >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f /v "QyClient" /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f /v "HCDNClient" /reg:32 >NUL 2>NUL

::移除相关临时数据和残留文件
del debug.log  >NUL 2>NUL
del rnd.spst  >NUL 2>NUL
rd/s/q "%Public%\Win"2>NUL
rd/s/q "%Public%\QiYi"2>NUL
rd/s/q "%ProgramData%\QiYi"2>NUL
rd/s/q "%AppData%\IQIYI Video"2>NUL
del /q "%windir%\psnetwork.ini" >NUL 2>NUL
rd/s/q "%CommonProgramFiles%\IQIYI Video"2>NUL
rd/s/q "%CommonProgramW6432%\IQIYI Video"2>NUL
rd/s/q "%CommonProgramFiles(x86)%\IQIYI Video"2>NUL
rd/s/q "%UserProfile%\AppData\LocalLow\VirtualStore"2>NUL

::移除所有磁盘的临时缓存数据
for %%a in (C D E F G H I G K L M N O P Q R S T U V W X Y Z) do rd /s/q "%%a:\qycache" 2>NUL

::移除桌面和开始菜单快捷方式
ver|findstr "5\.[0-9]\.[0-9][0-9]*" >NUL && (
del/q "%UserProfile%\桌面\爱奇艺*.lnk" >NUL 2>NUL
del/q "%AllUsersProfile%\桌面\爱奇艺*.lnk" >NUL 2>NUL
rd/s/q "%UserProfile%\「开始」菜单\程序\爱奇艺视频"2>NUL
rd/s/q "%AllUsersProfile%\「开始」菜单\程序\爱奇艺视频"2>NUL )
ver|findstr "\<6\.[0-9]\.[0-9][0-9]*\> \<10\.[0-9]\.[0-9][0-9]*\>" >NUL && (
del/q "%Public%\Desktop\爱奇艺*.lnk" >NUL 2>NUL
del/q "%UserProfile%\Desktop\爱奇艺*.lnk" >NUL 2>NUL
rd/s/q "%AppData%\Microsoft\Windows\Start Menu\Programs\爱奇艺视频"2>NUL
rd/s/q "%ProgramData%\Microsoft\Windows\Start Menu\Programs\爱奇艺视频"2>NUL )

::移除系统卸载列表项快捷方式
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\IQIYIVideo" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\IQIYIVideo" /f /reg:32 >NUL 2>NUL

::移除软件所以相关注册表键值
reg delete "HKCU\Software\QyImg" /f >NUL 2>NUL
reg delete "HKCU\IQIYI.HCDN" /f >NUL 2>NUL
reg delete "HKCU\IQIYI.COOK" /f >NUL 2>NUL
reg delete "HKCU\Software\QyGameClient" /f >NUL 2>NUL
reg delete "HKCU\Software\Classes\.qsv" /f >NUL 2>NUL
reg delete "HKEY_USERS\.DEFAULT\IQIYI.HCDN" /f >NUL 2>NUL
reg delete "HKCU\Software\Classes\.pfv" /f >NUL 2>NUL >NUL 2>NUL
reg delete "HKCU\Software\AppDataLow\Software\QiYi" /F>NUL 2>NUL
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tqs" /f >NUL 2>NUL
reg delete "HKCU\Software\Microsoft\Internet Explorer\New Windows\Allow" /f /v "*.pps.tv">NUL 2>NUL
reg delete "HKCU\Software\Microsoft\Internet Explorer\New Windows\Allow" /f /v "*.iqiyi.com">NUL 2>NUL
reg delete "HKCU\Software\Microsoft\Internet Explorer\New Windows\Allow" /f /v "*.ppstream.com">NUL 2>NUL
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /f /v "pps_pfv_.pfv">NUL 2>NUL

reg delete "HKCR\.pfv" /f >NUL 2>NUL
reg delete "HKCR\.pgf" /f >NUL 2>NUL
reg delete "HKCR\.pmv" /f >NUL 2>NUL
reg delete "HKCR\.qsv" /f >NUL 2>NUL
reg delete "HKCR\Applications\QyClient.exe" /f >NUL 2>NUL
reg delete "HKCR\Applications\QyUninst.exe" /f >NUL 2>NUL
reg delete "HKCR\HCDNProxy" /f >NUL 2>NUL
reg delete "HKCR\pps_pfv" /f >NUL 2>NUL
reg delete "HKCR\pps_qsv" /f >NUL 2>NUL
reg delete "HKCR\qips" /f >NUL 2>NUL
reg delete "HKCR\qisu" /f >NUL 2>NUL
reg delete "HKCR\qygameclient" /f >NUL 2>NUL

reg delete "HKLM\SOFTWARE\QiYi" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\QiYi.Client" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\QiYi" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\QiYi.Client" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\.pfv" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\.pgf" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\.pmv" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\.qsv" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\.pfv" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\.pgf" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\.pmv" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\.qsv" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Applications\QyClient.exe" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Applications\QyUninst.exe" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\HCDNProxy" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\pps_pfv" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\pps_qsv" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\qips" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\qisu" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\qygameclient" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\HCDNProxy" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\pps_pfv" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\pps_qsv" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\qips" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\qisu" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\qygameclient" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\PPStream.exe" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\QyClient.exe" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\GeePlayer.exe" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\PPStream.exe" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\QyClient.exe" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\GeePlayer.exe" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING" /f /v "QyClient.exe" >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING" /f /v "QyPlayer.exe" >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING" /f /v "QyFragment.exe" >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Low Rights\ElevationPolicy\{1E6BE0FB-8B18-4dfc-959F-233651CC4D7F}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Low Rights\ElevationPolicy\{BAC94FEE-45B4-4FD4-9EEA-D8978EC96C6E}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING" /f /v "QyClient.exe" /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING" /f /v "QyPlayer.exe" /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING" /f /v "QyFragment.exe" /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" /f /v "QXClient.exe" /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" /f /v "QyClient.exe" /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" /f /v "QyPlayer.exe" /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" /f /v "QyFragment.exe" /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Low Rights\ElevationPolicy\{1E6BE0FB-8B18-4dfc-959F-233651CC4D7F}" /f /reg:32 >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Internet Explorer\Low Rights\ElevationPolicy\{BAC94FEE-45B4-4FD4-9EEA-D8978EC96C6E}" /f /reg:32 >NUL 2>NUL

ECHO.&ECHO 清理完成，删除软件? [敲1]
ECHO.&ECHO Mooded by www.ghxi.com
CHOICE /C 1 /N >NUL 2>NUL
IF "%ERRORLEVEL%"=="1" PUSHD .. & RD /S/Q "%~DP0" >NUL 2>NUL