@ECHO OFF

cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && REG QUERY "HKU\S-1-5-19" 1>nul 2>nul || (  cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && ""%~s0"" %Apply%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )

::清除残留
rd /s/q "%AppData%\2345Pic\temp"2>NUL
rd /s/q "%AppData%\2345Pic\update"2>NUL
rd /s/q "%AppData%\2345Pic\pdf\adv"2>NUL
rd /s/q "%AppData%\2345Pic\pic_news"2>NUL
rd /s/q "%AppData%\2345Pic\SloganPic"2>NUL
del/f/q "%AppData%\2345Pic\RCImage*" >NUL 2>NUL
del/f/q "%AppData%\2345Pic\pdfapp.dat" >NUL 2>NUL
del/f/q "%AppData%\2345Pic\2345Image.hzv" >NUL 2>NUL
del/f/q "%AppData%\2345Pic\cloudconfig.dat" >NUL 2>NUL
del/f/q "%AppData%\2345Pic\RCOptimizeUpdate.hzc" >NUL 2>NUL
schtasks /delete /tn "Pic_2345Upgrade Task.job" /f >NUL 2>NUL
reg delete "HKLM\SYSTEM\CurrentControlSet\Services\ViewPic_2345Svc" /f >NUL 2>NUL

ECHO.&ECHO 正在关联文件类型注册缩列图
if exist 2345ImageThumb64.dll regsvr32 /s ".\2345ImageThumb64.dll"
if exist 2345PicLoader.exe start "" /wait "%~dp02345PicLoader.exe" -install 7 -invoke-platform-x64
if exist 2345PicLoader.exe start "" /wait "%~dp02345PicLoader.exe" --rescue --invoke-point=1
if exist 2345PicLoader.exe start "" /wait "%~dp02345PicLoader.exe" -skinselected 0 -invoke-platform-x64
if exist 2345PicLoader.exe start "" /wait "%~dp02345PicLoader.exe" -check-thumbnail -invoke-platform-x64
::解决10.10版本移除加入了PDF编辑器组件之后无法关联PDF文件问题
reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\OpenWithList" /f >NUL 2>NUL
reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\OpenWithProgids" /f >NUL 2>NUL
reg add "HKCU\SOFTWARE\Classes\2345Pic.pdf\DefaultIcon" /f /ve /d "%~dp0icon\pdf.ico" >NUL 2>NUL
reg add "HKCU\SOFTWARE\Classes\2345Pic.pdf\shell\open\command" /f /ve /d "\"%~dp02345PdfReader.exe\" \"%%1\"" >NUL 2>NUL

ECHO.&ECHO 完成，八年老站，每日更新 WWW.YPOJIE.COM &TIMEOUT /t 3 >NUL&EXIT