1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

problem whit date in Batch

Discussion in 'DOS/Other' started by amator, Jul 24, 2006.

Thread Status:
Not open for further replies.
Advertisement
  1. amator

    amator Thread Starter

    Joined:
    Jul 24, 2006
    Messages:
    7
    Hi
    I am trying to make Batch program which copy file which is created today. And I also want that this file is always named "backup".
    So my question is how I can tell to my "program" which date is today and copy the file what is created to day.
    I know that this works: "xcopy C:\programfiles\temp D:\backup /D:7-23-2006" but I want that my "program" works automaticly. And also could anyone tell how unite rename command in this same Bat-file or how to make this renaming.
    (sorry about my bad english but please help)
     
  2. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,418
    You could use something like AutoIt to create a little script to do the job.
     
  3. amator

    amator Thread Starter

    Joined:
    Jul 24, 2006
    Messages:
    7
    I got the date thing work. So my Batch copies the todays file, but can anyone tell me how I can rename the copied file always the same. My "code" is somethig like this:
    xcopy C:\programfiles\temp D:\backup... D:%DATE:~6,2%-%DATE:~3,2%-%DATE~9,4%
    But how I can add rename command to this?
    Thank about your answers:)
     
  4. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,418
    What do you want to rename the file to?
     
  5. amator

    amator Thread Starter

    Joined:
    Jul 24, 2006
    Messages:
    7
    I got it work. Now my batch copies and renames the file correctly. Thanks!
    But I still a little problem. How I can set that my batch file will be completed in every hour. I try to make that in Windows scheduled task but there is change only make it happen in every day.
     
  6. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,418
    In advanced properties, you can run the task ever hour, or every minute if you choose.
     

    Attached Files:

  7. amator

    amator Thread Starter

    Joined:
    Jul 24, 2006
    Messages:
    7
    Thanks
    Of course it can. I forgot the properties. Now I feel myself stupid:(
    Sorry about taking your time for nothing
     
  8. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,418
    No problem, I've answered dumber questions that that one. :D
     
  9. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - problem whit date
  1. Comprobs281
    Replies:
    1
    Views:
    132
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/485887

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice