1.

Solve : date log?

Answer»

Hi guys!
I have a small LITTLE question, everytime I start my PC a batch file saves the DATE, time and username in a %date%.log but if overwrites the file when i restart.
How can I make the batch save the next log in the same file in different line?Try this:

echo off
if exist %date%.log (
echo %time%---%username% >> %date%.log
) ELSE (
echo %time%---%username% > %date%.log
)

OR, you can just use the double >> signs and it will create a new file if required, or append the info on a new line.Not working, '07' is not recognised as an internal or external command, operating program or batch file.
It's too complicated this way, but I made it using just a file (Date.log) where is saved the date, time and username
Thank you for the help!What is the format of your date?
PLEASE send the result of
Code: [Select]echo %date%
I suspect it is made up with SLASHES as dividers, in which case you need to remove them before using it in a filename

is your logfile called just Date.log ?
in which case, do this
Code: [Select]>> date.log echo %date% %time%---%username%



Discussion

No Comment Found