1. Write scripts
@if not defined VS80COMNTOOLS (
echo VS80COMNTOOLS not defined. Have you install MSVC2005 correctly?
@pause
exit /b 1
)
call "%VS80COMNTOOLS%\vsvars32.bat" x86
@if not defined THIRDPARTY ( set THIRDPARTY=L:\thirdParty )
@if not defined QTDIR ( set QTDIR=%THIRDPARTY%\win\Qt4 ) @if not defined PROJECT_ROOT ( set PROJECT_ROOT=E:\projects ) set CONFIG_NAME=Debug set ACTION=Build @rem set ACTION=Rebuild @rem set MDTYPE=MDd :start_build devenv %1 /%ACTION% %CONFIG_NAME% @echo "Enther [r] to rebuild or other keys to exit." @set /p rbuild= @echo "Your input: %rbuild%" @if "%rbuild%"=="r" ( @echo "Start to rebuild ...." @goto start_build ) @pause
2. Add REG items
HKEY_CLASSES_ROOT\*\shell\VC_Debug\command
Key Value:cmd.exe /c "<your_build>.bat" %1
注意:这个方法,将会在每个文件 的 右键菜单中添加一个 “VC_Debug” 菜单。网上查资料说可以在 HKEY_CLASSES_ROOT\.vcproj 中按照上面的方法添加command, 但不知道为什么始终不能给.vcproj 文件添加上菜单。这里先搁置一下,以后有时间再处理一下。
如果想在添加的菜单上使用快捷键就将“build”改为“build(&B)”,这样就能在右键菜单中使用B快捷键了。