git绿色版添加右键菜单
Posted 「已注销」
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git绿色版添加右键菜单相关的知识,希望对你有一定的参考价值。
win10测试通过,win7未知
git
@Echo Off
title Git绿色版右键菜单管理bat工具
SetLocal EnableDelayedExpansion
SET SourceFile=git-bash.exe
if exist !cd!\\!SourceFile! (
echo 1.安装Git右键菜单
echo 2.卸载Git右键菜单
echo 0.退出
echo=
echo=
echo=
:start
Set /p u=请输入数字并按Enter确定:
IF !u!==1 (
@echo off
::git_gui
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\background\\shell\\git_gui" /d "Git &GUI Here" /t "REG_SZ" /f
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\background\\shell\\git_gui" /v "Icon" /d "!cd!\\cmd\\git-gui.exe" /t "REG_SZ" /f
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\background\\shell\\git_gui\\command" /d "\\"!cd!\\cmd\\git-gui.exe\\" \\"--working-dir\\" \\"%%v.\\"" /t "REG_SZ" /f
::git_shell
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\background\\shell\\git_shell" /d "Git Ba&sh Here" /t "REG_SZ" /f
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\background\\shell\\git_shell" /v "Icon" /d "!cd!\\git-bash.exe" /t "REG_SZ" /f
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\background\\shell\\git_shell\\command" /d "\\"!cd!\\git-bash.exe\\" \\"--cd=%%v.\\"" /t "REG_SZ" /f
::git_gui
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\shell\\git_gui" /d "Git &GUI Here" /t "REG_SZ" /f
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\shell\\git_gui" /v "Icon" /d "!cd!\\cmd\\git-gui.exe" /t "REG_SZ" /f
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\shell\\git_gui\\command" /d "\\"!cd!\\cmd\\git-gui.exe\\" \\"--working-dir\\" \\"%%1\\"" /t "REG_SZ" /f
::git_shell
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\shell\\git_shell" /d "Git Ba&sh Here" /t "REG_SZ" /f
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\shell\\git_shell" /v "Icon" /d "!cd!\\git-bash.exe" /t "REG_SZ" /f
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\shell\\git_shell\\command" /d "\\"!cd!\\git-bash.exe\\" \\"--cd=%%1\\"" /t "REG_SZ" /f
set u=<nul
echo=
echo install done.
goto start
) ELSE IF !u!==2 (
@echo off
reg delete>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\background\\shell\\git_gui" /f
reg delete>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\background\\shell\\git_shell" /f
reg delete>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\shell\\git_gui" /f
reg delete>nul 2>nul "HKEY_CLASSES_ROOT\\directory\\shell\\git_shell" /f
set u=<nul
echo=
echo uninstall done.
goto start
) ELSE IF !u!==0 (
exit
) ELSE (
goto start
)
) else (
set /p=请把该脚本放置在!SourceFile!所在目录下运行...<nul&pause;>nul
)
endlocal
Notepad3.bat
@Echo Off
title Notepad3绿色版右键菜单管理bat工具
SetLocal EnableDelayedExpansion
SET SourceFile=Notepad3.exe
SET RightMenuName=!SourceFile!打开
if exist !cd!\\!SourceFile! (
echo 1.安装Notepad3右键菜单
echo 2.卸载Notepad3右键菜单
echo 0.退出
echo=
echo=
echo=
:start
Set /p u=请输入数字并按Enter确定:
IF !u!==1 (
@echo off
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\*\\shell\\!RightMenuName!" /v "Icon" /d "!cd!\\!SourceFile!" /t "REG_SZ" /f
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\*\\shell\\!RightMenuName!" /v "MultiSelectModel" /d "Single" /t "REG_SZ" /f
reg add>nul 2>nul "HKEY_CLASSES_ROOT\\*\\shell\\!RightMenuName!\\Command" /d "\\"!cd!\\!SourceFile!\\" \\"%%1\\"" /t "REG_SZ" /f
set u=<nul
echo=
echo install done.
goto start
) ELSE IF !u!==2 (
@echo off
reg delete>nul 2>nul "HKEY_CLASSES_ROOT\\*\\shell\\!RightMenuName!" /f
set u=<nul
echo=
echo uninstall done.
goto start
) ELSE IF !u!==0 (
exit
) ELSE (
goto start
)
) else (
set /p=请把该脚本放置在!SourceFile!所在目录下运行...<nul&pause;>nul
)
endlocal
以上是关于git绿色版添加右键菜单的主要内容,如果未能解决你的问题,请参考以下文章