35 lines
1.2 KiB
Batchfile
35 lines
1.2 KiB
Batchfile
@echo off
|
|
setlocal
|
|
|
|
:: Define registry paths
|
|
set "REG_ROOT=HKCU\Software\Classes\Directory\Background\shell"
|
|
set "GIT_ACTIONS_KEY=%REG_ROOT%\GitActions"
|
|
set "GIT_PULL_KEY=%GIT_ACTIONS_KEY%\shell\gitpull"
|
|
|
|
:: Command to open Git Bash and execute 'git pull'
|
|
set "GIT_PULL_COMMAND=C:\\Program Files\\Git\\git-bash.exe -c \"cd '%V' && git pull && echo Press any key to continue && read\""
|
|
|
|
:: Add the 'Git Actions' submenu to the context menu
|
|
reg add "%GIT_ACTIONS_KEY%" /ve /d "Git Actions" /f
|
|
if %ERRORLEVEL% neq 0 goto Error
|
|
reg add "%GIT_ACTIONS_KEY%" /v "Icon" /d "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico" /f
|
|
if %ERRORLEVEL% neq 0 goto Error
|
|
reg add "%GIT_ACTIONS_KEY%" /v "Position" /d "Top" /f
|
|
if %ERRORLEVEL% neq 0 goto Error
|
|
|
|
:: Add the 'Pull with Git Bash' item to the 'Git Actions' submenu
|
|
reg add "%GIT_PULL_KEY%" /ve /d "Pull with Git Bash" /f
|
|
if %ERRORLEVEL% neq 0 goto Error
|
|
reg add "%GIT_PULL_KEY%\command" /ve /d "\"%GIT_PULL_COMMAND%\"" /f
|
|
if %ERRORLEVEL% neq 0 goto Error
|
|
|
|
echo Git Actions submenu with Pull with Git Bash item has been successfully added to the context menu.
|
|
goto End
|
|
|
|
:Error
|
|
echo Failed to add one or more registry keys.
|
|
goto End
|
|
|
|
:End
|
|
endlocal
|