@echo off set DEFAULT=$P$G git.exe %* git.exe branch > NUL 2>&1 if %ERRORLEVEL% EQU 128 goto norepos for /f "tokens=2" %%i in ('git.exe branch') do set BRANCH=%%i prompt $P (%BRANCH%) $G goto end :norepos prompt %DEFAULT% :end