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

::调整设置
::﹂取消启动后界面的提示
reg add "HKCU\SOFTWARE\ObviousIdea\ImageResizer\6.0" /f /v "FirstRun" /t REG_DWORD /d "0" >NUL 2>NUL
::﹂关闭发送匿名数据信息
reg add "HKCU\SOFTWARE\ObviousIdea\ImageResizer\6.0" /f /v "CollectUsageInfo" /t REG_DWORD /d "0" >NUL 2>NUL
::﹂取消自动检测升级(程序也已处理)
reg add "HKCU\SOFTWARE\ObviousIdea\ImageResizer\6.0" /f /v "CheckForUpdates" /t REG_DWORD /d "0" >NUL 2>NUL
::﹂保存记住窗口大小位置
reg add "HKCU\SOFTWARE\ObviousIdea\ImageResizer\6.0" /f /v "SaveWindowSize" /t REG_DWORD /d "1" >NUL 2>NUL

::添加资源管理器右键菜单
reg add "HKLM\SOFTWARE\Classes\*\shell\LightImageResizer" /f /ve /d "Light Image Resizer" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\*\shell\LightImageResizer" /f /v "CheckSupportedTypes" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\*\shell\LightImageResizer" /f /v "Icon" /d "%~dp0Resize.exe" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\*\shell\LightImageResizer\command" /f /ve /d "\"%~dp0Resize.exe\" \"%%1\"" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\*\shell\LightImageResizer\DropTarget" /f /v Clsid /d {3F899D2F-BAA0-4EED-95F3-73482BA073F8} >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe" /f /ve /d "Light Image Resizer" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\shell\open\command" /f /ve /d "%~dp0Resize.exe %%L" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\shell\open\DropTarget" /f /v Clsid /d {3F899D2F-BAA0-4EED-95F3-73482BA073F8} >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .3dr >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .arw >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .bmp >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .cr2 >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .crw >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .dcr >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .dng >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .emf >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .erf >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .gif >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .heic >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .ico >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .jp2 >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .jpeg >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .jpg >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .kdc >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .mef >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .mos >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .mrw >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .nef >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .nrw >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .orf >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .pcx >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .pef >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .png >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .ppm >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .psd >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .raf >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .raw >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .rw2 >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .sr2 >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .srf >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .srw >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .tga >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .tif >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .tiff >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .wdp >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .webp >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .wmf >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Applications\resize.exe\SupportedTypes" /f /v .x3f >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Folder\shell\LightImageResizer" /f /ve /d "Light Image Resizer" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Folder\shell\LightImageResizer" /f /v "AppliesTo" /d "System.ItemType:\"Directory\"" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Folder\shell\LightImageResizer" /f /v "Icon" /d "%~dp0Resize.exe" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Folder\shell\LightImageResizer\command" /f /ve /d "\"%~dp0Resize.exe\" \"%%1\"" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Folder\shell\LightImageResizer\DropTarget" /f /v "Clsid" /d "{3F899D2F-BAA0-4EED-95F3-73482BA073F8}" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\LightImageResizerAutoplay\shell\LightImageResizerAutoplay_741406\command" /f /ve /d "%~dp0Resize.exe %%L" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\LightImageResizerSubCommands\shell\!Default" /f /ve /d "Light Image Resizer" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\LightImageResizerSubCommands\shell\!Default" /f /v CommandFlags /t REG_DWORD /d "0x00000040" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\LightImageResizerSubCommands\shell\!Default" /f /v Icon /d "%~dp0Resize.exe" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\LightImageResizerSubCommands\shell\!Default" /f /v Clsid /d {3F899D2F-BAA0-4EED-95F3-73482BA073F8} >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Resize.LightImageResizer" /f /ve /d "Light Image Resizer DropTarget" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\Resize.LightImageResizer\Clsid" /f /ve /d "{3F899D2F-BAA0-4EED-95F3-73482BA073F8}" >NUL 2>NUL

IF NOT EXIST "%ProgramW6432%" (
reg add "HKLM\SOFTWARE\ObviousIdea" /f /v "ImageResizer" /d "%~dp0Resize.exe" >NUL 2>NUL
reg add "HKLM\SOFTWARE\ObviousIdea\ImageResizer\6.0" /f /v "InstallPath" /d "%~dp0Resize.exe" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\CLSID\{3F899D2F-BAA0-4EED-95F3-73482BA073F8}" /f /ve /d "Light Image Resizer DropTarget" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\CLSID\{3F899D2F-BAA0-4EED-95F3-73482BA073F8}\ProgID" /f /ve /d "Light Image Resizer" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\CLSID\{3F899D2F-BAA0-4EED-95F3-73482BA073F8}\LocalServer32" /f /ve /d "%~dp0Resize.exe" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\CLSID\{B85C6569-5465-46F3-BF3E-B725632EB8BE}" /f /ve /d "Light Image Resizer ExecuteCommand Handler" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\CLSID\{B85C6569-5465-46F3-BF3E-B725632EB8BE}\LocalServer32" /f /ve /d "%~dp0Resize.exe" >NUL 2>NUL
) ELSE (
reg add "HKLM\SOFTWARE\WOW6432Node\ObviousIdea" /f /v "ImageResizer" /d "%~dp0Resize.exe" >NUL 2>NUL
reg add "HKLM\SOFTWARE\WOW6432Node\ObviousIdea\ImageResizer\6.0" /f /v "InstallPath" /d "%~dp0Resize.exe" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\WOW6432Node\CLSID\{3F899D2F-BAA0-4EED-95F3-73482BA073F8}" /f /ve /d "Light Image Resizer DropTarget" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\WOW6432Node\CLSID\{3F899D2F-BAA0-4EED-95F3-73482BA073F8}\ProgID" /f /ve /d "Light Image Resizer" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\WOW6432Node\CLSID\{3F899D2F-BAA0-4EED-95F3-73482BA073F8}\LocalServer32" /f /ve /d "%~dp0Resize.exe" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\WOW6432Node\CLSID\{B85C6569-5465-46F3-BF3E-B725632EB8BE}" /f /ve /d "Light Image Resizer ExecuteCommand Handler" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\WOW6432Node\CLSID\{B85C6569-5465-46F3-BF3E-B725632EB8BE}\LocalServer32" /f /ve /d "%~dp0Resize.exe" >NUL 2>NUL
)

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\resize.exe" /f /ve /d "%~dp0Resize.exe" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\resize.exe" /f /v "DropTarget" /d "{3F899D2F-BAA0-4EED-95F3-73482BA073F8}" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\resize.exe" /f /v "DropTarget" /d "{3F899D2F-BAA0-4EED-95F3-73482BA073F8}" >NUL 2>NUL

ECHO.&ECHO 完成 &TIMEOUT /t 2 >NUL&EXIT