D
D
Dolvers2019-05-25 21:53:13
cmd/bat
Dolvers, 2019-05-25 21:53:13

How to turn on the timer so that in 10 seconds the Fail.bat file or the start Fail.bat runoff starts?

Through a command on the command line?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sergey, 2019-05-25
@Dolvers

TIMEOUT [/T] timeout [/NOBREAK]

timeout.exe /t 10
call fail.bat

S
slavius, 2019-06-04
​​@slavius

Determined the time, added 5 minutes, scheduled the launch via schtasks
schtasks /tn "NameTask" /delete
set /A start_h=%time:~0.2%
set /A start_m=%time:~3.2%
set /A start_s=%time:~6.2%
rem We assume that we fit in hours and minutes
set end_h=%start_h%
set end_m=%start_m%
rem Add seconds
set /A end_s=%start_s%+300
rem -whether in 60 seconds and 60 minutes
if %end_s% GTR 60 set /A end_m=%start_m%+%end_s%/60&&set /A end_s=%start_s%+(%1-%1/60)
if %end_m% GTR 60 set /A end_h=%start_h%+%end_m%/60&&set /A end_m=%start_m%+(%end_m%-%end_m%/60)
if %end_h% lss 10 schtasks /tn "NameTask" /create /U User /P password /TR "executable file" /SC once /ST 0%end_h%:%end_m%:00
schtasks /tn "comuchet" /create / U User /P password /TR "executable file" /SC once /ST %end_h%:%end_m%:00

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question