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: Place Time Stamp as a folder name

18 Oct 2011   #1

Windows 7 Professional 32 bit
Place Time Stamp as a folder name

I create many new temporary folders every day. I am looking for a quick way to paste a time/date stamp for each new folder name. Wondering if there is a way I can link the time stamp to a windows hot key and use a paste rule?

Don't want to use excel/word/cmd prompt and copy paste over to slow.

Google turned up useless so I knew I could turn here for some assistance!

Thank you.

My System SpecsSystem Spec
18 Oct 2011   #2

Windows 7 Professional SP1 32-bit

You can use the %date% and %time% environment variables in a DOS prompt.

Based on this, you could edit the registry to place an Explorer context menu shortcut to a command that creates a new folder in the current directory, along the lines of mkdir "Temp created on %date% at %time%".

Unfortunately this won't be of much help - I just realized the date includes slashes "/" and the time uses colons ":", both of which are invalid characters in a file/folder name.
My System SpecsSystem Spec
18 Oct 2011   #3

XP / Win7 x64 Pro

The following script will create a directory with the current timestamp (without the illegal characters):

@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)

set mydir="%mydate%_%mytime%"

mkdir %mydir%
Copy and paste that into something like "dirs.bat" and save it to your desktop. Then, with AHK, you could implement something like the following:

RAlt::Run C:\Documents and Settings\Username\Desktop\dirs.bat, C:\Documents and Settings\Username\Desktop
However, it will create the directory wherever the bat file is run from, in this case the Desktop. If there is a certain directory you're always creating these temp folders in, you could easily change the code to reflect that directory and place the .bat file in there.
My System SpecsSystem Spec

18 Oct 2011   #4

Windows 7 Professional SP1 32-bit

Awesome! That totally gets a rep from me. +1 :)
My System SpecsSystem Spec
18 Oct 2011   #5

Windows 7 Professional 32 bit

Thanks friends. I will try to run a set up as described above. Thanks for the quick response as well!!
My System SpecsSystem Spec
18 Oct 2011   #6

XP / Win7 x64 Pro

Just for further FYI with AHK, you can also run command line instructions directly from the script:

code = 
date /t 
time /t 
run %comspec% /k %code% 
My System SpecsSystem Spec
08 Nov 2012   #7

Windows 7 Pro 64-bit

As this was one of the top results for timestamps in Google, I'd thought I'd add a bit more.... Other options to use: Environment Variable Substrings: ie Extracts characters so 31/03/2012 = 12-03-31, and 14:59 = 1459 echo %date:~8,2%-%date:~3,2%-%date:~0,2% echo %time:~0,2%%time:~3,2% or another for loop format: for /f "tokens=1-3 delims=/" %%a in ('echo %date%') do @echo %%c%%b%%a or Time, w/o hundredths/sec: echo %time:~0,2%%time:~3,2% Environment Variable Substitution: ie Extracts characters so 31/03/2012 = 31032012, and 14:59 = 1459 echo %date:/=% Time, (with hundredths/sec) echo %TIME::=%
My System SpecsSystem Spec
12 Nov 2012   #8

64 win 7

About 5 years ago, a friend of mine made a right-click context menu that did exactly this in XP. It was a real time saver! If anyone is thinking of making one, please let me know.
My System SpecsSystem Spec

 Place Time Stamp as a folder name

Thread Tools

Similar help and support threads
Thread Forum
Incorrect date and time stamp on photos
Hello, I was wondering if anyone knows what's going on with my photo dates. I am using my work computer and camera to upload photos to our forum but every time I upload them to the computer from the camera it has the wrong date and time. I have checked and the camera is set correctly and the...
Music, Pictures & Video
Time Stamp Incorrect
When the user receives a voicemail on the land line, they are sent an email via a voicemail-to-email tool. The email has a copy of the voicemail, duration, phone number, etc. The time stamp within the email is correct. However, the time stamp that Microsoft puts in the message is incorrect. It is...
Microsoft Office
Time stamp missing from Date and Time column - Event Viewer
Has anybody else experienced this problem? I open Event Viewer - "Admin View" to see what Errors/Warnings are there and in the column - Date and Time only the date is showing. Same goes for all the other views. The "Time" element seems to have completely disappeared. Any idea where its...
Performance & Maintenance
I have a CAPI2 issue with consent.exe. and its time stamp on both pc.
Hi I have had a consentexe. issue for awhile now and I noticed its on both computers and both are less than 6 months old. Anyway is there a way to replace/repair a timestamp in a certain program like consentexe.? I know this is a user account program that is part of win7 64 bit but what exactly...
Windows Updates & Activation
System Image Time Stamp
I have a system image created today at 9:58am according to Windows Explorer. When I boot the Repair Disk and select that image, it shows the time as 6:59am --3 hrs earlier. I checked my BIOS and it shows the correct time. Anyone have any idea why this difference? Thank you.
Backup and Restore

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 22:45.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App