Monday, 15 August 2011

date - How to get mm-dd-yyyy in DOS batch file? -



date - How to get mm-dd-yyyy in DOS batch file? -

in batch file need file folder has today's date.

the problem can't batch date command homecoming proper format.

i have this: echo %date:/=-%

but returns example: fri 06-20-2014

what's proper phone call returning: 06-20-2014

looked on can't find.

thanks!

this works independent of regional date/time format:

for /f %%i in ('wmic os localdatetime ^|find "20"') set dt=%%i rem dt format yyyymmddhhmmss... set dt=%dt:~4,2%-%dt:~2,2%-%dt:~0,4% echo %dt%

date batch-file format

No comments:

Post a Comment