title: Batch file to repeat a program process
body: <p>Im not entirely familiar with command line scripting. I am trying to create a batch file to read in a txt file, apply a format which converts the file from a report into table and then export the file as spreadsheet.</p>
  
  <p>I can get the script to work for an individual file however if I try to run multiple files through a loop nothing happens. It launches the program goes through each script line but again doesn't do anything. It doesn't set the path. No crashes. Where as where I take the script out of the loop and apply it to a single file it works fine. Any suggestions?</p>
  
  <pre><code>SET monarch_bin="C:\Program Files (x86)\Datawatch\Monarch\Program\Monarch.exe"
  
   for /f "delims=" %%i in ('dir /b "C:\Users\Me\Desktop\Sample Monarach Input\*.txt"') do (
  
      echo File directory : %%i
  
      SET infilename=/Rpt: "C:\Users\Me\Desktop\Sample Monarach Input\%%i.txt" 
      echo ####### In file name:%infilename%
  
      SET model_file=/mod:"C:\Users\Me\Desktop\Sample Monarach Input\InvoiceSummary.xmod" 
      echo ####### Model: %model_file%
  
      SET outfilename=/exp:"C:\Users\Me\Desktop\Sample Monarach Input\OUTPUT.xlsx" 
      echo ####### Out file name:%outfilename%
  
      SET mode=/expfileopt:append /T
      echo ####### File: %%i
      %monarch_bin%%infilename%%model_file%%outfilename%%mode%
  pause
  )
  </code></pre>