title: How to combine two batch scripts, put them into one batch file and run them in descending order
body: <p>Hi I would like to take two batch scripts and combine them into " one ". I would also like the now " One " batch file to run in descending order. </p>
  
  <p>I am able to use the <code>CALL</code> function however, I then have three batch files.</p>
  
  <p>I am trying to combine them and achieve the same result as I would if I had to run batchA.bat and batchB.bat from the callbatchA+batchB.bat file</p>
  
  <blockquote>
    <p>e.g  callbatchA+B.batch, batchA.bat, batchB.bat </p>
  </blockquote>
  
  <p>I tried a simple <code>concat</code> of the files by running concatfile.bat included below</p>
  
  <pre><code>copy callbatchA+B.bat+batchA.bat+batchB.bat combined_.bat
  </code></pre>
  
  <p>This did not work example of <code>concatenated</code> file below</p>
  
  <pre><code>    ::CallScript
      CALL C:\Users\Myname\Desktop\batchA.bat
      CALL C:\Users\Myname\Desktop\BatchB.bat
      ::ScriptA
      @echo off 
      setlocal EnableDelayedExpansion
      CD "C:\deviceno\"
  
      ::only change these three lines
      set "start=295"  ::starts from this number
      set "amount=10" ::amount of files created
      set "length=5" :: 
  
      set /a "last=%start%+%amount%"
      for /l %%i in (%start%,1,%last%) do (
      set "folderName=0000000000%%i"
      set "folderName=!folderName:~-%length%!"
      md "!folderName!"
      )
      pausefor  
      ::ScriptB
      /D  %%a  in ("C:\deviceno\*.*") do xcopy  /y  /d  C:\Source\*.*"%%a\" 
  </code></pre>
  
  <p>I tried to edit the code with <code>goto :eof</code> such as below but I have had no luck so far.</p>
  
  <pre><code>::ScriptA
  @echo off
  setlocal EnableDelayedExpansion
  CD "C:\device_numbers\"
  
  ::only change these three lines
  set "start=295"  ::starts from this number
  set "amount=10" ::amount of files created
  set "length=5" :: 
  
  set /a "last=%start%+%amount%"
  for /l %%i in (%start%,1,%last%) do (
  set "folderName=0000000000%%i"
  set "folderName=!folderName:~-%length%!"
  md "!folderName!"
  ) DO CALL ::ScriptB
  
  ::ScriptB
  p /D  %%a  in ("C:\device_numbers\*.*") do xcopy  /y  /d   C:\Source\*.*"%%a\"
  goto :eof   
  </code></pre>