setlocal enabledelayedexpansion set var=%1 set output= for /f "delims=" %%a in ('git diff-tree --no-commit-id --name-only -r %1^^') do ( set output=!output! "%%a" ) git archive -o update-%var:~0,7%.zip HEAD %output% endlocal