We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Batch file or any program to copy variable preset file

Medium Priority
Last Modified: 2010-04-17

I wanted to create a batch file to copy a file (ddmmxxx.zip 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,2%xxx.zip h:\eurarchives

The above batch file tries to find out 4/00ats.zip.

Hope the question is clear.

Thanks in advance
Watch Question

Top Expert 2006

What date format is your machine in? UK/US ?

Type 'date' (and the hit return twice) at the command line to find out.
Top Expert 2006
If it's UK (dd-mm-yy[yy]), then you can use:

copy "k:\winentry\archives\%date:~0,2%%date:~3,2%xxx.zip" "h:\eurarchives"

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.