Batch file or any program to copy variable preset file


I wanted to create a batch file to copy a file ( where ddmm would be current date and month) from one location to another(k:\winentry\archives to h:\eurarchives). I think this should have been simple but i am a network guy with no programming background so please point out the problem in the below mentioned line.

copy k:\winentry\archives\%date:~4,2%%date:~7, h:\eurarchives

The above batch file tries to find out 4/

Hope the question is clear.

Thanks in advance
Who is Participating?
InteractiveMindConnect With a Mentor Commented:
If it's UK (dd-mm-yy[yy]), then you can use:

copy "k:\winentry\archives\%date:~0,2%%date:~3," "h:\eurarchives"
What date format is your machine in? UK/US ?

Type 'date' (and the hit return twice) at the command line to find out.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.