@echo off SET SOME_VAR="main.cpp" DEL /S "%SOME_VAR%" || echo "file not found" SET SOME_VAR="main.cpp.swp" DEL /S "%SOME_VAR%" || echo "file not found" CALL :_ex EXIT /B %ERRORLEVEL% :_ex echo >"main.cpp" echo >"main.cpp.swp" git add . git commit -m "first commit" EXIT /B 0