Solved

Attach todays date to a destination file's name in the COPY command

Posted on 2013-10-24
2
322 Views
Last Modified: 2013-10-24
copy P:\RCA-Self Pay\SP_Data\RCAHdr.csv + P:\RCA-Self Pay\SP_Data\RCA.csv P:\RCA-Self Pay\SP_Data\RCAData.txt

What can I add to the destination file name to put today's date in the format "YYYYMMDD" programatically?

Thanks

Glen
0
Comment
Question by:GPSPOW
2 Comments
 
LVL 4

Accepted Solution

by:
lindento earned 500 total points
ID: 39599185
Hi,

echo %date:~10,4%%date:~7,2%%date:~4,2%

will output the date as you requested but you might need to adjust the string location according to your local settings, on my system
Z:\>date /T
Fri 25/10/2013

so i grep out of this string starting from the 10 position next 4 characters which are 2013
and output it and so on.

So your copy command would look like this:

copy P:\RCA-Self Pay\SP_Data\RCAHdr.csv + P:\RCA-Self Pay\SP_Data\RCA.csv P:\RCA-Self Pay\SP_Data\RCAData%date:~10,4%%date:~7,2%%date:~4,2%.txt
which would add the date to the destination file.

Best Regards
0
 

Author Closing Comment

by:GPSPOW
ID: 39599194
Thanks

That did it.

Glen
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now