title: batch date time stamp compare
body: <p>Hey I have this little batch file that is supposed to compare the timestamps of two files and return errorvlvl 0 or 2 depending on whether the source file is newer or not (it gets passed the 2 filenames as parameters) but I dont think the gtr is workig right for timestamps.. I works some of the time and not others...how would I parse the timespamps as integers to compare them.
  btw the variables source and dest look like this (i echoed them to see)<br>
  05/06/2012  18:46</p>
  
  <pre><code> REM I use the t prefix here to expand the file location parameters passed in, i       into  date/time values
  set source=%~t1
  echo %dest%
  set dest=%~t2
  echo %source%
  
  if "%source%" gtr "%dest%" goto overwrite
  exit /b 0 
  :overwrite
  REM if the source file is newer compare.bat will return an errorlevel of 2, this will    then be used in an if statement in the file that called compare.bat to go ahead and overwrite the older file
  exit /b 2 
  </code></pre>
  
  <p>Thanks in advance for any advice!! :)</p>