|Here is the scenario, and I've got two questions: |
1. I've got a bat file, which continuously running on the background, and I would like to log that bat file to a text file.
I've got a code:
start cmd /k my_bat.bat > ./log_bat/log.txt
to log the output in my_bat.bat and write the output into a text file called log.txt
How can I add the current date and time in front of each new line?
2. The text file will get bigger and bigger in quite a quick manna, in one and half hour time it gets to 500kb already. Is there a way to set a file size limit, say 5mb, then if it exceed the size, rename it as another file name and continue logging?
Thank you very much