I have a batch file that is running 24/7 to check if a certain Programm is running and start it if not. It checks every 10 seconds and than writes an Console Entry as such.
@echo off
for /L %%n in (1,0,10) do (
tasklist /nh /fi "imagename eq AutoPrinter.exe" | find /i
"AutoPrinter.exe" >nul && (
echo %date% %time:~0,8% AutoPrinter already running
echo %date% %time:~0,8% AutoPrinter already running>>
autostarterlog.txt
) || (
start AutoPrinter.exe
echo %date% %time:~0,8% AutoPrinter started
echo %date% %time:~0,8% AutoPrinter started >> autostarterlog.txt
)
timeout /T 10
)
However timestamps are not updating so the output looks like this
20.06.2019 10:45:41 AutoPrinter started
20.06.2019 10:45:41 AutoPrinter already running
20.06.2019 10:45:41 AutoPrinter already running
etc...
Is there anyway to update the timestamps so they display the actual time and not always the starting time?