Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

batch file

Options
  • 05-10-2005 4:50pm
    #1
    Registered Users 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 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 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 Posts: 245 ✭✭Polonious


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


Advertisement