@ECHO OFF & PUSHD "%~DP0"
REG QUERY "HKU\S-1-5-19">NUL 2>&1 || (
reg add "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /f /v "%~dp0release\x64\x64dbg.exe" /d "~ RUNASADMIN" >NUL 2>NUL
reg add "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /f /v "%~dp0release\x32\x32dbg.exe" /d "~ RUNASADMIN" >NUL 2>NUL
)
REG QUERY "HKU\S-1-5-19">NUL 2>&1 || (powershell -Command "Start-Process '%~sdpnx0' -Verb RunAs"&&EXIT)

::创建根目录快捷方式
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""%~sdp0\"") & ""x32dbg.lnk""):b.TargetPath=""%~sdp0release\x32\x32dbg.exe"":b.WorkingDirectory=""%~sdp0"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""%~sdp0\"") & ""x64dbg.lnk""):b.TargetPath=""%~sdp0release\x64\x64dbg.exe"":b.WorkingDirectory=""%~sdp0"":b.Save:close")


ECHO.&ECHO [1] 添加右键菜单、桌面图标和数据库图标
ECHO.&ECHO [2] 删除右键菜单、桌面图标和数据库图标

CHOICE /C 12 /N >NUL 2>NUL
  
IF "%ERRORLEVEL%"=="2" (
reg delete "HKLM\SOFTWARE\Classes\.dd32" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\.dd64" /f >NUL 2>NUL
reg delete "HKLM\exefile\Shell\Debug with x32dbg" /f >NUL 2>NUL
reg delete "HKLM\exefile\Shell\Debug with x64dbg" /f >NUL 2>NUL
reg delete "HKLM\dllfile\Shell\Debug with x32dbg" /f >NUL 2>NUL
reg delete "HKLM\dllfile\Shell\Debug with x64dbg" /f >NUL 2>NUL
reg delete "HKCR\dllfile\Shell\Debug with x64dbg" /f >NUL 2>NUL
reg delete "HKCR\dllfile\Shell\Debug with x32dbg" /f >NUL 2>NUL
reg delete "HKCR\exefile\Shell\Debug with x64dbg" /f >NUL 2>NUL
reg delete "HKCR\exefile\Shell\Debug with x32dbg" /f >NUL 2>NUL
reg delete "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /f /v "%~dp0release\x64\x64dbg.exe" >NUL 2>NUL
reg delete "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /f /v "%~dp0release\x32\x32dbg.exe" >NUL 2>NUL
del/q "%UserProfile%\桌面\x*dbg.lnk" >NUL 2>NUL
del/q "%AllUsersProfile%\桌面\x*dbg.lnk" >NUL 2>NUL
del/q "%Public%\Desktop\x*dbg.lnk" >NUL 2>NUL
del/q "%UserProfile%\Desktop\x*dbg.lnk" >NUL 2>NUL
del/q "%UserProfile%\Desktop\x*dbg.lnk" >NUL 2>NUL
del/q "%UserProfile%\Desktop\x*dbg.lnk" >NUL 2>NUL
ECHO.&ECHO 删除完成
TIMEOUT /t 3 >NUL&EXIT
)

IF "%ERRORLEVEL%"=="1" (
start "" /wait "%~dp0release\x96dbg.exe"
ECHO.&ECHO 添加完成
TIMEOUT /t 3 >NUL&EXIT
)