how to make directory with name of date

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

how to make directory with name of date

#1 Post by Mohammad_Dos » 02 Nov 2010 04:23

Hello,
I want to make a directory with name of date

for example today is: 2010/11/02
directory name: 2010-11-02

or other type of names that show the date

thank u

acun
Posts: 3
Joined: 02 Nov 2010 02:46

Re: how to make directory with name of date

#2 Post by acun » 02 Nov 2010 08:38

Hi there,

Try this:

Set MM=%date:~4,2%
Set DD=%date:~7,2%
Set YYYY=%date:~-4%

md %YYYY%-%MM%-%DD%

Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

Re: how to make directory with name of date

#3 Post by Mohammad_Dos » 02 Nov 2010 13:01

thank u very much acun

Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

Re: how to make directory with name of date

#4 Post by Mohammad_Dos » 19 Nov 2010 07:37

please explain:

%date:~4,2%
%date:~7,2%
%date:~-4%

Post Reply