title: why is the goto command ignored in my batch file?
body: <p>In my batch I process a csv file, upon hitting an error in processing  the playerSync.exe file the batch will loop and restart processing the csv file after the line that hit the problem. The trouble is that the next call to findstr will fail to find the error message even though it's there.  The tail.bat file shows it but the call to findstr fails to see it and so the else message "some other error" gets printed and eof is reached.  Or is the <code>goto loop</code> line  just getting skipped and the processing falling through to <code>goto eof</code> somehow?  The wait.bat, copycsv.bat   seem to run right without problem so I doubt the trouble is in there.
  So my question is why can't I find the same string with repeated calls to findstr in my batch file ?
  UPDATE - NEW QUESTION:  why is the goto command ignored in my batch file?</p>
  
  <pre><code>@echo. &gt;&gt; dataupdatelog.txt
  @echo ============================================ &gt;&gt; dataupdatelog.txt
  @echo %date% - %time% &gt;&gt; dataupdatelog.txt
  @echo ============================================ &gt;&gt; dataupdatelog.txt
  @echo. &gt;&gt; dataupdatelog.txt
  @echo off
  REM RENAME PlayerSyncLog.txt "PlayerSyncLog_%date:~-4,4%%date:~-7,2%%date:~0,2%_%time:~0,2%%time:~3,2%%time:~6,4%.TXT"
  
  rem call download.bat &gt;&gt; dataupdatelog.txt
  SET CSVFILE=fromwebsite.csv
  REM call PlayerSync.exe -SYNC %CSVFILE%
  :loop
  time /T
  findstr /c:"Import Successful!" "PlayerSyncLog.txt" &gt;nul 2&gt;&amp;1 &amp;&amp; (
      tail.bat
      goto success    
  ) || (
  
      findstr /c:"Error found in row" "PlayerSyncLog.txt" &gt;nul 2&gt;&amp;1 &amp;&amp; (
          echo "found exception  error"
  
          echo "copycsv"
          copycsv.bat
          time /T 
          RENAME PlayerSyncLog.txt "PlayerSyncLog_%date:~-4,4%%date:~-7,2%%date:~0,2%_%time:~0,2%%time:~3,2%%time:~6,4%.TXT"
  
          call PlayerSync.exe -SYNC %CSVFILE%
          time /T 
          echo "wait 240"
          wait.bat 240
          time /T
          echo "GOTO loop"
      GOTO loop
      echo "after GOTO loop"
  ) || (
      echo "some other error"
      GOTO success
  ))  
  
  :success
  
  rem call backitup.bat &gt;&gt; dataupdatelog.txt
  rem call upload.bat &gt;&gt; dataupdatelog.txt
  rem call uploadlogs.bat &gt;&gt; dataupdatelog.txt
  </code></pre>
  
  <p>UPDATED CODE:
  added the /I to the findstr command and also added the line  <code>echo "after goto loop"</code> to see if the goto was ignored and it was, the "after goto loop" gets echoed, eg output from a run is:</p>
  
  <pre><code>C:\Documents and Settings\Administrator\Desktop\website xfer&gt;mybatch.bat
  "loop"
  02:52 PM
  "check for error"
  "found exception  error"
  (1 row affected)
  "copycsv"
  02:54 PM
  "call playersync after error found"
  02:54 PM
  "wait 240"
  02:58 PM
  "goto loop"
  "after goto loop"
  C:\Documents and Settings\Administrator\Desktop\website xfer&gt;
  </code></pre>
  
  <p>So, new question, why is the goto command ignored?</p>
  
  <p>UPDATE 2:  the new scripts seems to be working :</p>
  
  <pre><code>@echo. &gt;&gt; dataupdatelog.txt
  @echo ============================================ &gt;&gt; dataupdatelog.txt
  @echo %date% - %time% &gt;&gt; dataupdatelog.txt
  @echo ============================================ &gt;&gt; dataupdatelog.txt
  @echo. &gt;&gt; dataupdatelog.txt
  @echo off
  rem RENAME PlayerSyncLog.txt "PlayerSyncLog_%date:~-4,4%%date:~-7,2%%date:~0,2%_%time:~0,2%%time:~3,2%%time:~6,4%.TXT"
  
  rem call download.bat &gt;&gt; dataupdatelog.txt
  SET CSVFILE=fromwebsite.csv
  rem call PlayerSync.exe -SYNC %CSVFILE%
  rem echo "wait 240"
  rem call wait.bat 240
  
  GOTO BEGIN
  :LOOP
  echo "loop"
  time /T 
  
  
  call  copycsv.bat
  
  time /T 
  
  RENAME PlayerSyncLog.txt "PlayerSyncLog_%date:~-4,4%%date:~-7,2%%date:~0,2%_%time:~0,2%%time:~3,2%%time:~6,4%.TXT"
  
  echo "call playersync after error found"
  call PlayerSync.exe -SYNC %CSVFILE%
  time /T 
  echo "wait 240"
  call wait.bat 240
  time /T
  
  rem END LOOP    
  
  
  :BEGIN
  
  
  rem tail.bat
  findstr /I /c:"Import Successful!" "PlayerSyncLog.txt" &gt;nul 2&gt;&amp;1 &amp;&amp; (
      echo "success"
      SET SUCCESS=0
  ) || (
      echo "check for error"    
      findstr /I /c:"Error found in row" "PlayerSyncLog.txt" &gt;nul 2&gt;&amp;1 &amp;&amp; (
          echo "found exception  error"
          SET SUCCESS=1
  
      ) || (
          echo "some other error"
          SET SUCCESS=2
      )
  )   
  
  echo "SUCCESS==" %SUCCESS%
  if %SUCCESS% == 1 ( GOTO LOOP ) else ( GOTO END )
  
  
  :END
  
  rem call backitup.bat &gt;&gt; dataupdatelog.txt
  rem call upload.bat &gt;&gt; dataupdatelog.txt
  rem call uploadlogs.bat &gt;&gt; dataupdatelog.txt
  </code></pre>