title: My batch script only works the second time
body: <p>I have written a batch script that commits my GIT repository from a file. This script first asks if I am sure I want to commit the staged changes then looks for the changelog file and stops if it is not found, if it is found, the commit is done, a backup of the changelog is created and the changelog is emptied.</p>
  
  <p>Now my issue is that the first time I call it in a command prompt it asks me if I really want to commit, and whatever I answer it stops right after that (well not quite true, it DOES execute the <code>PAUSE</code> command, without writing anything else, just as if I didn't type y or Y). All the times I run it in the SAME command prompt after that first time, it works as expected. Now that never breaks anything, but having to run it twice every time is a bit useless and most probably is a bug and avoidable, so any help is appreciated ;)</p>
  
  <p>Here is my script</p>
  
  <pre><code>@ECHO OFF
  set displayErr=0
  set /p isOk="Do you really want to commit the staged work? (Y/N)"
  
  if "%isOk%"=="y" set isOk=Y
  
  if "%isOk%"=="Y" (
      echo "Looking for changelog"
      set filter="%~dp0\..\changelog\changelog.txt"
      for %%A in (%filter%) do if %%~zA==0 (
          echo."%%A" is empty
      ) else (
          git commit -F "%%A"
  
          if ERRORLEVEL 1 (
              echo Cancelling. "git commit" returned an error code...
          ) else (
              copy "%%A" "%%A.backup"
              copy /y NUL "%%A"
          )
      )
  ) else (
      echo "Cancelling..."
  )
  
  PAUSE
  </code></pre>
  
  <p>Thanks in advance :)</p>