初始可用。

This commit is contained in:
2026-03-07 23:01:32 +08:00
commit 5d0c57b858
9 changed files with 779 additions and 0 deletions

View File

@@ -0,0 +1,116 @@
@echo off
setlocal
title Quick XMake 右键菜单安装
echo =========================================
echo Quick XMake - 右键菜单安装工具
echo =========================================
echo.
REM 获取当前目录
for %%I in ("%~dp0.") do set "TOOLDIR=%%~fI"
set "DLLPATH=%TOOLDIR%\quick-xmake.dll"
REM 检查 DLL 文件是否存在
if not exist "%DLLPATH%" (
echo 错误: quick-xmake.dll 未找到
echo 请将此批处理文件与 quick-xmake.dll 放在同一目录
echo.
pause
exit /b 1
)
echo 正在安装右键菜单...
echo.
REM 清理旧的注册表项
echo 清理旧的注册表项...
reg delete "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake" /f 2>nul
REM 创建一级菜单
echo 创建一级菜单...
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake" /ve /d "" /f
if %errorlevel% neq 0 (
echo 错误: 创建一级菜单失败
goto :error
)
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake" /v "MUIVerb" /d "quick-xmake" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake" /v "Icon" /d "%%SystemRoot%%\System32\shell32.dll,50" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake" /v "SubCommands" /d "" /f
REM 创建二级菜单项
echo 创建二级菜单项...
REM 二级菜单:Create
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\create" /ve /d "" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\create" /v "MUIVerb" /d "Create" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\create\command" /ve /d "rundll32.exe \"%DLLPATH%\",ContextMenuHandler \"%%V\" 0" /f
REM 二级菜单:Build
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\build" /ve /d "" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\build" /v "MUIVerb" /d "Build" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\build\command" /ve /d "rundll32.exe \"%DLLPATH%\",ContextMenuHandler \"%%V\" 1" /f
REM 二级菜单:Set debug mode
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\set-debug" /ve /d "" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\set-debug" /v "MUIVerb" /d "Set debug mode" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\set-debug\command" /ve /d "rundll32.exe \"%DLLPATH%\",ContextMenuHandler \"%%V\" 2" /f
REM 二级菜单:Set release mode
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\set-release" /ve /d "" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\set-release" /v "MUIVerb" /d "Set release mode" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\set-release\command" /ve /d "rundll32.exe \"%DLLPATH%\",ContextMenuHandler \"%%V\" 3" /f
REM 二级菜单:Run
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\run" /ve /d "" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\run" /v "MUIVerb" /d "Run" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\run\command" /ve /d "rundll32.exe \"%DLLPATH%\",ContextMenuHandler \"%%V\" 4" /f
REM 二级菜单:Template
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\template" /ve /d "" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\template" /v "MUIVerb" /d "Template" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\quick-xmake\shell\template\command" /ve /d "rundll32.exe \"%DLLPATH%\",ContextMenuHandler \"%%V\" 5" /f
echo.
echo =========================================
echo 安装成功!
echo =========================================
echo.
echo 菜单结构:
echo 在文件夹空白处右键 =》 quick-xmake =》
echo ├── Create
echo ├── Build
echo ├── Set debug mode
echo ├── Set release mode
echo └── Run
echo.
echo 注意事项:
echo 1. 本脚本已自动以管理员权限运行
echo 2. 新菜单需要重新打开资源管理器才能显示
echo 3. 需要重启资源管理器吗?
echo.
choice /c YN /n /m "重启资源管理器 (Y/N): "
if %errorlevel% equ 1 (
echo 正在重启资源管理器...
taskkill /f /im explorer.exe >nul 2>&1
start explorer.exe
echo 资源管理器已重启
) else (
echo 您可以选择稍后手动重启资源管理器
echo 或重新打开文件夹查看新菜单
)
echo.
pause
exit /b 0
:error
echo.
echo 安装过程中出现错误,请检查:
echo 1. 是否以管理员身份运行
echo 2. 注册表权限是否正常
echo 3. 文件路径是否包含特殊字符
echo 4. DLL文件是否被其他程序占用
echo.
pause
exit /b 1