批处理文件 - 关闭时的时间戳

时间:2021-03-18 14:26:45

标签: file batch-file timestamp

我编写了一个批处理文件,将时间戳放入文件中,然后每经过一分钟就执行一次。

@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

0 个答案:

没有答案
相关问题