Create folder with name as current date in batch (.bat) file

Flowing script will create a folder with name as the current date in format YYYY.MM.DD format e.g. 2012.05.14


for /f "skip=1" %%i in ('wmic os get localdatetime') do if not defined fulldate set fulldate=%%i
set year=%fulldate:~0,4%
set month=%fulldate:~4,2%
set day=%fulldate:~6,2%
set foldername=%year%.%month%.%day%
md %foldername%

Windows XP and higher

 

 

 


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha
captcha
Reload