Display text from .txt file in batch file
hmm.. just found the answer. it's easier then i thought. it just needs a bunch more stuff:
@echo off
if not exist log.txt GOTO :write
echo Date/Time last login:
type log.txt
del log.txt
:write
echo %date%, %time%. >> log.txt
@pause
exit
So it first reads the log.txt file and deletes it. After that it just get a new file (log.txt) with the date & time!
I hope this helps other people!
(the only prob is that the first time it does not work, but then just enter in random value at log.txt.) (This problem is solved and edited.)
type log.txt
But that will give you the whole file. You could change it to:
echo %date%, %time% >> log.txt
echo %date%, %time% > log_last.txt
...
type log_last.txt
to get only the last one.