Batch file or any program to copy variable preset file

Posted on 2006-04-03
Last Modified: 2010-04-17

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
Question by:Madhusudanbanik
    LVL 25

    Expert Comment

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

    Type 'date' (and the hit return twice) at the command line to find out.
    LVL 25

    Accepted Solution

    If it's UK (dd-mm-yy[yy]), then you can use:

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

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Suggested Solutions

    A short article about problems I had with the new location API and permissions in Marshmallow
    Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    734 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

    22 Experts available now in Live!

    Get 1:1 Help Now