better_git_bash/find_bash.bat
2023-08-20 03:03:37 +08:00

17 lines
420 B
Batchfile

@echo off
setlocal
REM 运行 "where git" 命令获取 git.exe 的路径
for /f "delims=" %%I in ('where git') do set "git_path=%%~dpI"
REM 获取 git.exe 所在的文件夹路径
for %%I in ("%git_path%..") do set "git_folder=%%~fI"
REM 构建目标路径
set "target_path=%git_folder%\bin\bash.exe"
REM 将路径中的单反斜杠替换为双反斜杠
set "target_path=%target_path:\=\\%"
echo %target_path%
pause