我编写了一个批处理文件,将时间戳放入文件中,然后每经过一分钟就执行一次。
@echo off
setlocal enabledelayedexpansion
goto :main
:main
echo !time:~0,5%! -start>> time.txt
:loop
findstr>nul /rc:"\<!time:~0,5%!\>" time.txt
if !errorlevel!==0 (
goto :loop
)else (
echo !time:~0,5%!>> time.txt
echo
goto :loop
)
goto :eof
但是当我关闭程序时如何让它产生时间戳?
输出看起来像这样
15:23 -start
15:24
15:25