@echo off SET SOME_VAR=.\first.txt DEL /S "%SOME_VAR%" || echo "file not found" SET SOME_VAR=.\second.txt DEL /S "%SOME_VAR%" || echo "file not found" CALL :_ex EXIT /B %ERRORLEVEL% :_ex echo "2 files have been created !" echo un> first.txt echo deux> second.txt dir *.txt git add first.txt EXIT /B 0