Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

batch file

  • 05-10-2005 04:50PM
    #1
    Registered Users, Registered Users 2 Posts: 245 ✭✭


    I've created a batch file that runs each night and works fine. However i want it to create a log file when it ends and put the time and date in it. Does anyone know how this can be done?


Comments

  • Closed Accounts Posts: 6,151 ✭✭✭Thomas_S_Hunterson


    as far as i know, something like this will work
    echo.|date > [textfilename]

    basically when you use > after a command, it outputs the screen text to a text file specified


  • Registered Users, Registered Users 2 Posts: 1,726 ✭✭✭gerryk


    Use >> or the file will be recreated at each echo :D

    Also, there are better things than DOS date for echoing the date...
    Either logtime http://malektips.com/xp_dos_0004.html
    or now http://malektips.com/xp_dos_0010.html


  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    Or you can do

    DATE /T > log.txt
    TIME /T >> log.txt

    You could also use the SET command like...

    echo Log completed at %TIME% on %DATE% > log.txt

    No need to install 3rd party programs (if your on XP that is)


  • Registered Users, Registered Users 2 Posts: 245 ✭✭Polonious


    Thats excellent guys thanks. Hobbes, I used that line and it worked just as i wanted. Cheers.


Advertisement