[powershell] insert current time to file / Windows下插入当前时间到指定文件

REM:生成一个文件
del  > Time.log
echo > Time.log

REM:获取系统日期及时间,同时将时间转换为8位(8:16:00-->08:16:00).写入文件。
:ABC
set   CurDate=%date:~0,10%
set   CurTime=%time%
set   hh=%CurTime:~0,2%
if   /i   %hh%   LSS   10   ( set   hh=0%CurTime:~1,1% )
set   mm=%CurTime:~3,2%
set   ss=%CurTime:~6,2%
set   CurDateTime=%CurDate%_%hh%:%mm%:%ss%

REM: 修改“D:”为存储所对应的盘符
echo %CurDateTime%  >>  D:Time.log
timeout /T 1
GOTO ABC
原文地址:https://www.cnblogs.com/alfredsun/p/10941870.html