title: Batch Script Exiting from Encountering For-Loop
body: <p>The program exits without warning as soon as it hits the second FOR loop <code>FOR /F %inputDir% %%F in (*.jpg) do</code> </p>
  
  <p>I am running on a windows 10 machine, moving and renaming pictures</p>
  
  <p>I have already tried putting in break points and flags, but to no avail. I even tried just having a dummy load (just an echo and then pause) inside the FOR loop (FL) since I learned from somewhere that batch executes entire FLs at once. I have <strong>NOT</strong> tried using delayed expansion, but willing to learn how.</p>
  
  <pre><code>@echo off
  echo LOADING CONFIG
  cd "Batch stuff"
  FOR /F "tokens=1,2 delims=&amp;" %%A in (config.txt) do (
  REM echo %%A
  REM echo %%B
  SET inputDir=%%A
  SET outputDir=%%B
  )
  echo inputDirectory: %inputDir%
  echo outputDirectory: %outputDir%
  
  echo CONFIG LOADED
  echo Continue?
  pause
  
  
  
  
  
  FOR /F %inputDir% %%F in (*.jpg) do (
  echo here
  pause
  cls
  echo openning: %%F
  echo newName: 
  SET /P newName=Enter a new name for this image: 
  cls 
  echo openning: %%F
  echo newName: %newName%
  
  echo Hit space to continue or exit the program (manually)
  pause
  REM CALL nameAndMove %%F %newName%
  
  
  )
  </code></pre>
  
  <p>Expected results:
  Second FL runs
       opens the picture 
       Prompts for newName
       clears Screen
       re-displays information (filepath and newName) and asks for confirmation
       calls to a WIP subroutine (FL didn't work even when I wasn't calling to the sub)</p>
  
  <p>I am not able to see any error messages since the program exits before I get a chance to see any. Even with the pause function after the second FOR loop, I am still unable to get the program to freeze. I assume this has something to do with incorrect syntax, since the FL failed with a dummy load.</p>
  
  <p>Filepath:</p>
  
  <p><a href="https://i.stack.imgur.com/OtODP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OtODP.png" alt="Filepath"></a></p>