0

i am making a bat file that does a few tasks for me but i need to get the current date in MMDDYY format.

I know this will return the 4 digit year but how can i make it show 12 instead of 2012? for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set year=%%c

jardane
  • 461
  • 4
  • 11
  • 21
  • possible duplicate: [windows-batch-formatted-date-into-variable](http://stackoverflow.com/questions/10945572/windows-batch-formatted-date-into-variable) – wmz Aug 01 '12 at 17:26

1 Answers1

4

set MMDDYY=%DATE:~4,2%%DATE:~7,2%%DATE:~12,2%

check the return from echo %DATE% to see if you need to make adjustment for locale

SeanC
  • 15,695
  • 5
  • 45
  • 66