@echo off setlocal for %%i in ("%~dp0.") do set "script_dir=%%~fi" cd %script_dir% 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 "bashrc_path=%git_folder%\etc" set "sh_path=%git_folder%\etc\profile.d" echo %bashrc_path% echo %sh_path% copy bash.bashrc "%bashrc_path%" copy git-prompt.sh "%sh_path%" pause