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

:MENU
ECHO.&ECHO  1、添加资源管理器右键菜单项
ECHO.&ECHO  2、删除资源管理器右键菜单项

CHOICE /C 12 /N >NUL 2>NUL
IF "%ERRORLEVEL%"=="2" GOTO RemoveMenu
IF "%ERRORLEVEL%"=="1" GOTO AddMenu

:AddMenu

reg add "HKCR\*\shellex\ContextMenuHandlers\UltraCompare" /f /ve /d "{C3B42C03-C1B7-4c1a-B384-BBAE19646333}" >NUL 2>NUL
reg add "HKCR\CLSID\{C3B42C03-C1B7-4c1a-B384-BBAE19646333}\InProcServer32" /f /ve /d "%~dp0UC_ShellExt64.dll" >NUL 2>NUL
reg add "HKCR\CLSID\{C3B42C03-C1B7-4c1a-B384-BBAE19646333}\InProcServer32" /f /v "ThreadingModel" /t REG_SZ /d "Apartment" >NUL 2>NUL
reg add "HKCR\Directory\shellex\ContextMenuHandlers\UltraCompare" /f /ve /d "{C3B42C03-C1B7-4c1a-B384-BBAE19646333}" >NUL 2>NUL

reg add "HKCU\Software\Directory\shellex\ContextMenuHandlers\UltraCompare" /f /ve /d "{C3B42C03-C1B7-4c1a-B384-BBAE19646333}" >NUL 2>NUL
reg add "HKCU\Software\Classes\*\shellex\ContextMenuHandlers\UltraCompare" /f /ve /d "{C3B42C03-C1B7-4c1a-B384-BBAE19646333}" >NUL 2>NUL
reg add "HKCU\Software\Classes\CLSID\{C3B42C03-C1B7-4c1a-B384-BBAE19646333}\InProcServer32" /f /ve /d "%~dp0UC_ShellExt64.dll" >NUL 2>NUL
reg add "HKCU\Software\Classes\CLSID\{C3B42C03-C1B7-4c1a-B384-BBAE19646333}\InProcServer32" /f /v "ThreadingModel" /t REG_SZ /d "Apartment" >NUL 2>NUL
reg add "HKCU\Software\Classes\Directory\shellex\ContextMenuHandlers\UltraCompare" /f /ve /d "{C3B42C03-C1B7-4c1a-B384-BBAE19646333}" >NUL 2>NUL

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\uc.exe" /f /v "Path" /d "%~dp0\" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\uc.exe" /f /ve /d "%~dp0uc.exe" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs"  /f /v "%~dp0wodFtpDLX64.dll" /t REG_DWORD /d "1" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs"  /f /v "%~dp0wodCertificate64.dll" /t REG_DWORD /d "1" >NUL 2>NUL

ECHO.&ECHO 添加完成 &TIMEOUT /t 2 >NUL&CLS&GOTO MENU

:RemoveMenu

reg delete  "HKCR\*\shellex\ContextMenuHandlers\UltraCompare" /f >NUL 2>NUL
reg delete  "HKCR\*\shellex\{C3B42C03-C1B7-4c1a-B384-BBAE19646333}" /f >NUL 2>NUL
reg delete  "HKCR\Directory\shellex\ContextMenuHandlers\UltraCompare" /f >NUL 2>NUL

reg delete  "HKCU\Software\Directory\shellex\ContextMenuHandlers\UltraCompare" /f >NUL 2>NUL
reg delete  "HKCU\Software\Classes\*\shellex\ContextMenuHandlers\UltraCompare" /f >NUL 2>NUL
reg delete  "HKCU\Software\Classes\CLSID\{C3B42C03-C1B7-4c1a-B384-BBAE19646333}" /f >NUL 2>NUL
reg delete  "HKCU\Software\Classes\Directory\shellex\ContextMenuHandlers\UltraCompare" /f >NUL 2>NUL

reg delete  "HKLM\SOFTWARE\IDM Computer Solutions\UltraCompare" /f >NUL 2>NUL
reg delete  "HKCU\Software\IDM Computer Solutions\UltraCompare Pro" /f >NUL 2>NUL

reg delete  "HKCR\*\shellex\ContextMenuHandlers\UltraCompare" /f >NUL 2>NUL
reg delete  "HKCR\*\shellex\{C3B42C03-C1B7-4c1a-B384-BBAE19646333}" /f >NUL 2>NUL
reg delete  "HKCR\Directory\shellex\ContextMenuHandlers\UltraCompare" /f >NUL 2>NUL

reg delete  "HKCU\Software\Directory\shellex\ContextMenuHandlers\UltraCompare" /f >NUL 2>NUL
reg delete  "HKCU\Software\Classes\*\shellex\ContextMenuHandlers\UltraCompare" /f >NUL 2>NUL
reg delete  "HKCU\Software\Classes\CLSID\{C3B42C03-C1B7-4c1a-B384-BBAE19646333}" /f >NUL 2>NUL
reg delete  "HKCU\Software\Classes\Directory\shellex\ContextMenuHandlers\UltraCompare" /f >NUL 2>NUL

ECHO.&ECHO 删除完成 &TIMEOUT /t 2 >NUL&CLS&GOTO MENU