@ECHO OFF & PUSHD "%~DP0" && CD /D "%~DP0"
IF EXIST "%PUBLIC%" >NUL 2>&1 REG QUERY "HKU\S-1-5-19"
IF NOT %ERRORLEVEL% EQU 0 (
IF EXIST "%PUBLIC%" powershell.exe -windowstyle hidden -noprofile "Start-Process '%~dpnx0' -Verb RunAs"
EXIT
)

taskkill /f /im WSHelper* >NUL 2>NUL
taskkill /f /im PDFelement* >NUL 2>NUL

::清理万兴产品垃圾组件及开机启动项 Wondershare Helper Compact；
rmdir/s/q "%LocalAppData%\Wondershare" 2>NUL
rmdir/s/q "%AllUsersProfile%\Application Data\Wondershare" 2>NUL
rmdir/s/q "%AppData%\Wondershare\Wondershare Helper Compact" 2>NUL
rmdir/s/q "%CommonProgramFiles%\Wondershare\Wondershare Helper Compact" 2>NUL
rmdir/s/q "%CommonProgramFiles(x86)%\Wondershare\Wondershare Helper Compact" 2>NUL
reg delete "HKCU\SOFTWARE\Wondershare\Wondershare Helper Compact" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Wondershare\Wondershare Helper Compact" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\WOW6432Node\Wondershare\Wondershare Helper Compact" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\WSCustomerServicePlatform.CustomerService" /f >NUL 2>NUL
reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f /v "Wondershare Helper Compact.exe" >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f /v "Wondershare Helper Compact.exe" >NUL 2>NUL
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run" /f /v "Wondershare Helper Compact.exe" >NUL 2>NUL

start /wait /B FileAssociation.exe /UnInstallFileUnAssociate >NUL 2>NUL

attrib -r -a -s -h -x "%temp%\WhatsNewFile_万兴PDF专家.xml"
attrib -r -a -s -h -x "%temp%\FullUpdateConfig_万兴PDF专家.xml"
attrib -r -a -s -h -x "%temp%\PatchUpdateConfig_万兴PDF专家.xml"
rmdir/s/q "%temp%\WhatsNewFile_万兴PDF专家.xml"2>NUL
rmdir/s/q "%temp%\PatchUpdateConfig_万兴PDF专家.xml"2>NUL
rmdir/s/q "%temp%\FullUpdateConfig_万兴PDF专家.xml"2>NUL

rmdir/s/q "%ProgramData%\PDFelement 7" 2>NUL
rmdir/s/q "%AppData%\Wondershare\PDFelement 7" 2>NUL
rmdir/s/q "%AppData%\Wondershare\PDFelement 6 Pro" 2>NUL
rmdir/s/q "%AllUsersProfile%\Application Data\Wondershare"2>NUL
rmdir/s/q "%LOCALAPPDATA%\Wondershare"2>NUL
rmdir/s/q "%LOCALAPPDATA%\PDFelement 7"2>NUL
rmdir/s/q "%USERPROFILE%\Local Settings\Wondershare"2>NUL
del/f/q "%PUBLIC%\Desktop\万兴PDF专家.lnk" >NUL 2>NUL
del/f/q "%UserProfile%\Desktop\万兴PDF专家.lnk" >NUL 2>NUL
del/f/q "%AllUsersProfile%\Desktop\Adobe Photoshop 2020.lnk" >NUL 2>NUL

for /f "skip=2 tokens=3 delims= " %%i in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v personal') do (
       for /f "delims=*" %%j in ('echo %%i') do rmdir/s/q "%%j\Wondershare" 2>NUL)

reg delete "HKCR\wspe7" /f >NUL 2>NUL
reg delete "HKCR\.fdf\OpenWithList\PDFelement.exe" /f  >NUL 2>NUL
reg delete "HKCR\.pdf\OpenWithList\PDFelement.exe" /f  >NUL 2>NUL
reg delete "HKCR\Applications\PDFelement.exe" /f >NUL 2>NUL
reg delete "HKCR\WondersharePDF.Document7"  /f >NUL 2>NUL
reg delete "HKCR\SystemFileAssociations\.pdf\Shell\WondersharePDFExpert" /f  >NUL 2>NUL
reg delete "HKCR\CLSID\{7561CFCF-E2B1-478B-9595-2B029D2418E8}" /f >NUL 2>NUL

reg delete "HKLM\Software\Wondershare\Wondershare PDF Expert" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Wondershare\Wondershare PDFelement 7" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723" /f >NUL 2>NUL
reg delete "HKLM\Software\Wow6432Node\Wondershare\Wondershare PDF Expert" /f  >NUL 2>NUL
reg delete "HKCU\SOFTWARE\Wondershare\Wondershare PDFelement 6 pro" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Wondershare\Wondershare PDFelement 6 pro" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Wow6432Node\Wondershare PDF Expert" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Wow6432Node\Wondershare PDFelement 7" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Wow6432Node\Wondershare PDFelement 7" /f >NUL 2>NUL
reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.fdf"  /f >NUL 2>NUL
reg delete "HKLM\Software\Classes\WondersharePDF.Document7" /f   >NUL 2>NUL
reg delete "HKLM\Software\Classes\SystemFileAssociations\.pdf\Shell\WondersharePDFExpert" /f >NUL 2>NUL
reg delete "HKLM\Software\Classes\SystemFileAssociations\.pdf\Shell\WondersharePDFExpertPrint" /f >NUL 2>NUL

ECHO. &ECHO 完成！&PAUSE >NUL 2>NUL & EXIT