Archive from April, 2013
Apr 28, 2013 - General, Powershell, Scripting    1 Comment

How can I create / name a folder with today’s date?

This is very handy if you are using scripts to generate daily logs and would like to put them in a folder with the current date. You can, of course, tweak the commands to suit your requirements:


for /F “tokens=1-4 delims=/ ” %%A in (‘date /t’) do (
set DateDay=%%A
set DateMonth=%%B
set DateYear=%%C

set CurrentDate=%DateDay%-%DateMonth%-%DateYear%

md %CurrentDate%

This will give you a newly created folder with┬átoday’s┬ádate, in the format of DD-MM-YY

Related Posts Plugin for WordPress, Blogger...