1.

Solve : Date and time in batch file?

Answer»

I have a small PROBLEM: I use a batch file that runs an AUTOMATIC backup of a software and FILLS a log-file of backup process. At the moment I use date /t and time /t commands with a pre-typed strings of text to monitor different sub processes in the backup, but it writes the time and string on SEPARATE row whereas I would like them on the same row, like this:

mon 02.03.2009
21:00 Process started
21:01 Backup 1 finished
21:08 Backup 2 finished
21:10 Backup finished succesfully

The commands that I have been using are obviously the reason:
time /t >> %LogFilePath%\Backup.log
echo Backup finished succesfully >> %LogFilePath%\Backup.log

Is there any command I can make it write the strings on the same row as the time?

-Jussi

You might try something like this:

Code: [SELECT]Echo %time:~0,5% Backup finished successfully >>%LogFilePath%\Backup.log



Discussion

No Comment Found