title: batch script subroutine: Passing arguments
body: <p>My understanding is that in order to get the date from a file passed into a subroutine as an argument, you must re-set that argument as a variable within the subroutine.  Is this correct?  This doesn't make since to me, so I am wondering if I do not fully understand what is going on.  I can use the passed in argument in practically any other subroutine code except for date extraction.</p>
  
  <pre><code>set setupEXE=setup.exe
  
  CALL :SUB_CheckCorrectDate %setupEXE%
  GOTO EOF
  ::----------------------------------
  
  :SUB_CheckCorrectDate
  set filename=%1%
  
  :: SUCCESSFUL
  for %%x in (%filename%) do set FileDate=%%~tx
  @For /F "tokens=1-3 delims=-/ " %%A in ('@echo %FileDate%') do @( 
  Set file_Month=%%A
  Set file_Day=%%B
  Set file_Year=%%C
  )
  
  :: GET ERROR    
  for %%x in (%1%) do set FileDate=%%~tx
  @For /F "tokens=1-3 delims=-/ " %%A in ('@echo %FileDate%') do @( 
  Set file_Month=%%A
  Set file_Day=%%B
  Set file_Year=%%C
  )    
  
  GOTO:EOF
  
  :: ------------------
  :EOF
  </code></pre>