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
cmasterdc22

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
Corazon

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
FliGi7

XP / Win7 x64 Pro
 
 

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

Code:
@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:

Code:
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
Corazon

Windows 7 Professional SP1 32-bit
 
 

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

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
FliGi7

XP / Win7 x64 Pro
 
 

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

Code:
code = 
(join& 
date /t 
time /t 
) 
run %comspec% /k %code% 
return
My System SpecsSystem Spec
08 Nov 2012   #7
mrsf

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
Ceezo

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
Reply

 Place Time Stamp as a folder name




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Preserving date and time stamp on all files copied?
Hello, I have a new computer with Windows 7 on it - and I want to copy the files from my old computer to my new one. I'm looking at copying about 300 GB worth of data. When I copy all files and insert them onto my new desktop, I notice that all of the date/time stamps are changed to today's...
General Discussion
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
Right Place, Wrong Time: 9 Technologies Born Before Their Time
Read more at: Maximum PC | Right Place, Wrong Time: 9 Technologies Born Before Their Time
Chillout Room
Change date and time stamp on file save...
When I create a file in Windows 7 and save it I get the current date and time stamp but when I edit the program at a later time and date and save again it doesn't change the date and time stamp it stays the same as the original file! I feel like a moron but how can I change this?
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 20:03.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App