Create a date and time stamped folder from dos cmd prompt

ok so you need to create a directory based on the current time and date, a timestamp if you will.

its easy, type thisĀ into your cmd window …

mkdir %date:~-4,4%%date:~-7,2%%date:~0,2%-%time:~0,2%%time:~3,2%%time:~6,2%

this will give you a directory named like YYYYMMDD-HHMMSS

Enjoy.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • MisterWong
  • Reddit
  • Technorati

2 Responses to “Create a date and time stamped folder from dos cmd prompt”


  1. 1 programmer

    The sample produces an incorrect format like 2009ep4. Check your code please

  2. 2 jason.white

    Hi Programmer, It works exactly as expected on Vista Ultimate and Win 2003 Server.. what are you running?

Leave a Reply