title: How to show the number in a text file and number plus one?
body: <p>I am a newbie of windows batch 
  I would like to write batch to generate a series of log file.
  sorry my poor english. 
  let me try to explain what i want. </p>
  
  <p>I have 5 Variables. </p>
  
  <ol>
  <li>Period </li>
  <li>Symbol</li>
  <li>Start Year</li>
  <li>End Year</li>
  <li>Setting</li>
  </ol>
  
  <p>I stored all variable into a text file. </p>
  
  <pre><code>Period.txt
  ----------
  
  15min 30min
  
  Symbol.txt
  ----------
  
  AAA BBB CCC
  
  StartYear.txt
  -------------
  
  2012 2013 2014 2015 2016
  
  EndYear.txt (Actually the End Year is Start Year +1 )
  -----------------------------------------------------
  
  2013 2014 2015 2016 2017
  
  Setting.txt
  -----------
  
  Setting1 Setting2 Setting3 Setting4 Setting5
  </code></pre>
  
  <p>I would like to generate a list of file XXX.log 
  named <code>Setting_StartYear_EndYear_Max_period_Symbol.log</code></p>
  
  <p>For example:</p>
  
  <pre><code>Setting1_2012_2013_Max__15min_AAA.log    Setting1_2012_2013_Max__15min_BBB.log    Setting1_2012_2013_Max__15min_CCC.log    Setting1_2012_2013_Max__30min_AAA.log    Setting1_2012_2013_Max__30min_BBB.log    Setting1_2012_2013_Max__30min_CCC.log
  </code></pre>
  
  <h2>And each of the log file will show this content.</h2>
  
  <pre><code>; Tested settings Report
  Tested Period=15min
  Tested Symbol=AAA
  Tested Start Year=2012
  Tested End Year=2013
  Tested Setting=Setting2
  ; End settings Report
  </code></pre>
  
  <p>I wrote a batch file called <strong>gen.bat</strong></p>
  
  <pre><code>@echo off
  SET output_filename=%%E_%%C_%%D_Max_%Symbol%_%%A_%%B
  SET BaseDir=%cd%
  For /f "delims=" %%E in (%BaseDir%\Setting.txt) do (
  For /f "delims=" %%D in (%BaseDir%\EndYear.txt) do (
  For /f "delims=" %%C in (%BaseDir%\StartYear.txt) do (
  For /f "delims=" %%B in (%BaseDir%\Symbol.txt) do (
  For /f "delims=" %%A in (%BaseDir%\Period.txt) do (
  REM --------GEN Then log file-----------
  Echo.; Tested settings Report&gt;%output_filename%.log
  Echo.Tested Period=%%A&gt;&gt;%output_filename%.log
  Echo.Tested Symbol=%%B&gt;&gt;%output_filename%.log
  Echo.Tested Start Year=%%C&gt;&gt;%output_filename%.log
  Echo.Tested End Year=%%D&gt;&gt;%output_filename%.log
  Echo.Tested Setting=%%E&gt;&gt;%output_filename%.log
  Echo.; End settings Report&gt;&gt;%output_filename%.log
  )))))
  </code></pre>
  
  <p>the result is, it is generating a lot of files with <strong>wrong</strong> start and end year like this </p>
  
  <pre><code>Setting1_2012_2012_Max__15min_AAA.log &lt;&lt; Wrong
  Setting1_2012_2012_Max__15min_BBB.log &lt;&lt; Wrong
  Setting1_2012_2012_Max__15min_CCC.log &lt;&lt; Wrong
  Setting1_2012_2012_Max__30min_AAA.log &lt;&lt; Wrong
  Setting1_2012_2012_Max__30min_BBB.log &lt;&lt; Wrong
  Setting1_2012_2012_Max__30min_CCC.log &lt;&lt; Wrong
  Setting1_2012_2013_Max__15min_AAA.log &lt;&lt; Correct (as end year must be next year of start year )
  Setting1_2012_2013_Max__15min_BBB.log &lt;&lt; Correct (as end year must be next year of start year )
  Setting1_2012_2013_Max__15min_CCC.log &lt;&lt; Correct (as end year must be next year of start year )
  Setting1_2012_2013_Max__30min_AAA.log &lt;&lt; Correct (as end year must be next year of start year )
  Setting1_2012_2013_Max__30min_BBB.log &lt;&lt; Correct (as end year must be next year of start year )
  Setting1_2012_2013_Max__30min_CCC.log &lt;&lt; Correct (as end year must be next year of start year )
  Setting1_2012_2014_Max__15min_AAA.log &lt;&lt; Wrong
  Setting1_2012_2014_Max__15min_BBB.log &lt;&lt; Wrong
  Setting1_2012_2014_Max__15min_CCC.log &lt;&lt; Wrong
  Setting1_2012_2014_Max__30min_AAA.log &lt;&lt; Wrong
  </code></pre>
  
  <p>Could anyone could help me to fine tune my script? </p>
  
  <p>I had tried with a few days but don't know how to correct the batch.</p>