Operating System - Microsoft
1753631 Members
5657 Online
108798 Solutions
New Discussion юеВ

Re: Add date and time to a file name

 
Kyris
Frequent Advisor

Add date and time to a file name

Could someone please let me know how I can add the date and time to a file name so that it makes it unique...easy in unix but do not seem to be able to do it in Windows.
I already have a vbs that adds the date but I now also need the time.
I include the script that may help someone that knows this well to just add the missing 'bits'.

thanks
kyris

 

 

P.S. This thread has been moved from Archived Desktops and Workstations Boards > Windows based to Microsoft > general. - Hp forum moderator

3 REPLIES 3
Pat Flanagan
Honored Contributor

Re: Add date and time to a file name

Kyris,

I'm certain that this has come up in the forums before, about a year ago or so.

Go to the Forums advanced search link at the top of this page, and search in both ITRC and Business Support forums.

Pat
Kyris
Frequent Advisor

Re: Add date and time to a file name

Pat,

Thanks for your reply..I appreciate it. I had a quick look but could not find anything but I will have a more thorough look later on using various criteria in the search.
thanks kyris
Kyris
Frequent Advisor

Re: Add date and time to a file name

Perhaps there is a simpler way but here it is adding the date to a file name - set in a batch file...

set YYYYMMDD=%DATE:~10,4%%DATE:~7,2%%DATE:~4,2%

type c:\reports\myreport.txt >> c:\reports\myreport_%YYYYMMDD%.txt