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.

Solved: Adding a timestamp to Batch Scripts

Discussion in 'Windows XP' started by asgt, Jan 4, 2008.

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

    asgt Thread Starter

    Joined:
    Jan 23, 2007
    Messages:
    65
    Hi Guys,

    I am running a batch file through the night to copy things between servers (using the xcopy command).

    The files being copied are quite large (171MB) and I am wanting to know what time they finish copying over.

    I have a Pause command at the end of the script which allows me to see that it has finished successfully when I arrive at work in the morning. Is there a way for it to insert a timestamp just before the pause to show the finishing time?


    Regards
    Andy
     
  2. devil_himself

    devil_himself

    Joined:
    Apr 7, 2007
    Messages:
    4,910
    Something Like This May Help

    set LogFile=C:\TheLog.txt
    @echo Start copy: %Date% %Time% >"%LogFile%"
    copy ......
    @echo End copy: %Date% %Time% >>"%LogFile%"
     
  3. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,783
    date /T
    time /T
     
  4. asgt

    asgt Thread Starter

    Joined:
    Jan 23, 2007
    Messages:
    65
    Both of those work well. Just the kind of thing I was after

    Thanks
     
  5. devil_himself

    devil_himself

    Joined:
    Apr 7, 2007
    Messages:
    4,910
    Glad We Could Help :)
     
  6. 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!

Thread Status:
Not open for further replies.

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

  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