|
Answer» Hi All,
I want to have a log of the below batch script i wrote and can't SEEM to find a way to create it.
start /wait /b xcopy "z:\*.id" "c:\notes\data" /d /L /y >> "C:\Documents and Settings\Administrator\Desktop\ID_Log.txt"
echo. |time |find "current" >> log echo. |date |find "current" >> log
I have managed to get the FILES that are copied into a log file, but i would like have the output of the batch file with a date stamp saved into a log file.
please keep in mind this is my first ever attempt to WRITING a batch script, i am open to any suggestions. Perhpas my approach is WRONG or there is a better way of doing this.
Thanks in advance for any assistance or tips.Using start /wait is only helpful when the started task runs in it's own window and there is a need for the batch file to wait. Otherwise, running commands in-line accomplishes the same thing without wasting resources or adding complexity.
Code: [Select]xcopy "z:\*.id" "c:\notes\data" /d /L /y >> "C:\Documents and Settings\Administrator\Desktop\ID_Log.txt"
echo. |time |find "current" >> "C:\Documents and Settings\Administrator\Desktop\ID_Log.txt" echo. |date |find "current" >> "C:\Documents and Settings\Administrator\Desktop\ID_Log.txt"
Note that the XCOPY will append the log to any existing log. If you wish to create a new log each time you run your file, REPLACE >> with > on the XCOPY line.
Good luck.
|