Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Create a directory on startup with date i.e. 12-03-2012

12 Mar 2012   #1

windows 7 64 Bit
Create a directory on startup with date i.e. 12-03-2012

Hi there,

I would like to create a daily folder on system startup which has the date like this 12-03-2012

I also want it to go to a certain place on my hard drive C:Users/Name/My Documents

I have this script but it puts the date the wrong way around and I would prefer dashes in between the dates?

for /f "skip=1" %%d in ('wmic os get localdatetime') do if not defined mydate set mydate=%%d
md %mydate:~0,8%

Thanks in advance, Jay ;-)

My System SpecsSystem Spec
12 Mar 2012   #2

windows 7 64 Bit

Ok slightly different way of doing this, now get the dashes between the dates

SET dd=%DATE:~0,2%-
SET mm=%DATE:~3,2%-
SET yyyy=%DATE:~6,4%

mkdir %dd%%mm%%yyyy%

How do I set the path for it create the dated folder? do I just add the path after mkdir?

i.e. C:Users\Name\My Documents

My System SpecsSystem Spec
12 Mar 2012   #3

Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64

you can probably add the path to the filename as you thought.

mkdir C:Users\<Name>\Documents\%dd%%mm%%yyyy%

Or you can put this line in before the mkdir to set the path. (cd = change directory)
cd C:Users\<Name>\Documents

note: i think you need to use "Documents" (not "My Documents") in Win 7

<Name> would be your user name...
My System SpecsSystem Spec

13 Mar 2012   #4

windows 7 64 Bit

thanks for that... I will try that later.
My System SpecsSystem Spec
13 Mar 2012   #5

Windows 7 Pro x64 SP1

I I have done this in a simpler step.
give this a shot. But remember if you run it twice, it is setup to let you know it already exists.

copy the following:

rem this will create a directory in your documents directory
set DATEST=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%
echo %datest%
if exist %homepath%\documents\%datest% goto already
md %homepath%\documents\%datest%
goto end1
rem you already have created the directory %datest% in your %homepath%
My System SpecsSystem Spec

 Create a directory on startup with date i.e. 12-03-2012

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar help and support threads
Thread Forum
Can`t create a restore date
Hi I can`t create a restore date,when i go to system restore,there are no dates,on trying to create one.I get the message (no room on HP recovery disc due to 0x800700.I cant clean it ,the disc is full ,how do i go about it. My system restore settings are, (G) AND (C) are restore settings and...
Backup and Restore
Is it possible to Create a Symbolic Link to a Non-Specific Directory?
Hi there I was wondering if I can create a symbolic link to a folder location that changes???? Eg. %APPDATA%/
General Discussion
Crash on a specific directory using Acronis True Image Home 2012
Hello All, I'm using Acronis True Image Home 2012 to do Directory and System backup. I have 6 different backup job and most of them are working fine but on a particular file system with pictures my system crash every time ! I have multiple dump of the crash (including a full dump), I ran a...
BSOD Help and Support
Excel 2010 question: Date 00-00-0000 (08-03-2012)(dd-mm-yyyy)
Yo folks, Annoying little thing in excel, I want to show the date exactly like this: 00-00-0000 (08-03-2012)(dd-mm-yyyy) Instead excel removes the zero's like this: 0-0-0000 (8-3-2012) (d-m-yyyy) Is it possible to keep the zero's? Thanks in advanced,
Microsoft Office
Xcopy cannot create directory
My backup cmd file has been in use since XP, through Vista to Win7. It has worked on a new laptop in Win7 ever since Win7 was released. Recently it has stopped working getting an access denied, cannot create directory message. It is xcopying my own folders, not the default documents etc. In a cmd...
General Discussion
Ivy Bridge Benchmarks, Specifications, and Q2 2012 Release Date Leak
Read more at: Maximum PC | Ivy Bridge Benchmarks, Specifications, and Q2 2012 Release Date Leak

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 01:26.

Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App