- Oct 9, 2003
- 51,649
- 53,857
- AFL Club
- North Melbourne
- Other Teams
- Eagles (NFL), Suns (NBA)
One for the DOS savvy.
I've created a simple batch file called backup.bat that outputs the date and time before backing up my mail files from my internal HD to my external HD. This is the contents of the batch file:
When these commands are executed in the DOS console, I want to be able to capture all the text that appears in the console into a log file.
Any help on how I can get this text above into a log file as it's being executed? Essentially, what I want to be able to do is when the batch file starts, open a log file, have everything dumped into the log file, then at the end, close the log file.
I don't just want the output of each command sent to a log file, I want both the input commands as well as the output, as they appear on the screen like the code above, sent to a log file. I've tried ECHO, COPY, TYPE, etc, but no luck.
Thanks.
I've created a simple batch file called backup.bat that outputs the date and time before backing up my mail files from my internal HD to my external HD. This is the contents of the batch file:
Code:
time /t
date /t
cd C:\Documents and Settings\Outlook
xcopy /e/y/d/f *.* E:\Backup\Outlook
pause
When these commands are executed in the DOS console, I want to be able to capture all the text that appears in the console into a log file.
Code:
C:\>time /t
6:38p
C:\>date /t
Sun 02/22/2009
C:\>cd C:\Documents and Settings\Outlook
C:\Documents and Settings\Outlook>xcopy /e/y/d/f *.* E:\Backup\Outlook
0 File(s) copied
C:\Documents and Settings\Outlook>pause
Press any key to continue . . .
Any help on how I can get this text above into a log file as it's being executed? Essentially, what I want to be able to do is when the batch file starts, open a log file, have everything dumped into the log file, then at the end, close the log file.
I don't just want the output of each command sent to a log file, I want both the input commands as well as the output, as they appear on the screen like the code above, sent to a log file. I've tried ECHO, COPY, TYPE, etc, but no luck.
Thanks.



