at 命令好像不支持秒, 下面的代码默认是分钟加1(n=1)
@echo off
set /a n=1
echo aa=dateadd("n",%n%,now)>t.vbs
echo CreateObject("WScript.Shell").Run "cmd /c echo "^&aa^&">t.txt",^0>>t.vbs
t.vbs
ping -n 1 127.1>nul
for /f "tokens=2" %%i in (t.txt) do at %%i notepad
del t.vbs t.txt
@ECHO OFF
SETLOCAL
SET NOW=%TIME%
ECHO NOW---%NOW%>&2
FOR /F "UseBackQ Delims=: Tokens=1-3" %%A IN (`ECHO %NOW%`) DO (
SET Hour=%%A
SET Minute=%%B
SET Second=%%C
)
SET H0=%Hour:~0,1%
IF "%H0%" == "0" SET Hour=%Hour:~1,1%
SET M0=%Minute:~0,1%
IF "%M0%" == "0" SET Minute=%Minute:~1,1%
SET MS=%Second:~3,1%
SET Second=%Second:~0,2%
SET S0=%Second:~0,1%
IF "%S0%" == "0" SET Second=%Second:~1,1%
IF %MS% GEQ 5 SET /A Second+=1
SET /A Second+=10
IF %Second% GEQ 60 (
SET /A Second-=60
SET /A Minute+=1
IF %Minute% GEQ 60 (
SET /A Minute-=60
SET /A Hour+=1
IF %Hour% GEQ 24 SET /A Hour-=24
)
)
SET After10s=%Hour%:%Minute%:%Second%
ECHO After10s---%After10s%>&2
AT %After10s% "具体命令"
ENDLOCAL