title: How to sort the arguments dropped to a batch file?
body: <p>I am writing a batch file that finds and executes all <code>update.bat</code> file inside all the directories dropped onto it.</p>
  
  <p>The problem here is that I expect the arguments (i.e directories' path) comes in ordered by name but it turns out they are sorted by the modified date.</p>
  
  <p>Is this the default behavior of Windows (Windows 7)? Any suggestion to solve this?</p>
  
  <hr>
  
  <p>Here is  my batch script:</p>
  
  <pre><code>@echo off
  Setlocal EnableDelayedExpansion
  
  if [%1]==[] goto :no_update_dropped
  
  set LOG_FILE=update_log.txt
  
  echo You are about to run these updates:
  for %%G IN (%*) do (
    if exist %%~sG\NUL echo %%G
  )
  
  pause
  
  for %%G IN (%*) do (
    if exist %%G\NUL (
          if exist %%G\update.bat (
              call %%G\update.bat %LOG_FILE%
          ) else (
              echo No update.bat found in %%G.
              goto :no_batch_found
          )
      )
  )
  goto :success
  
  :no_update_dropped
  echo NO UPDATE FOLDER FOUND
  echo Drag and drop one or more update folder to run.
  goto :exit
  
  :no_batch_found
  echo UPDATE NOT COMPLETED!
  goto exit
  
  :success
  echo all updated has been run successfully
  goto :exit
  
  :exit
  pause
  </code></pre>
  
  <p>Best Regards.</p>