更新时间:2023-10-29 23:04:40
超时"可能是在没有任务计划程序的情况下计划任务的好命令.
'Timeout' might a good command to schedule your task without Task Scheduler.
timeout /t 1500
[command to trigger Python script]
因此,您想要此批处理文件需要在早上运行...",您还可以设置开始时间和结束时间:
So you want 'This batch file needs to run in the morning...', you can set the start time and end time as well:
set timeHrs=%time:~0,2%
set timeMin=%time:~3,2%
set timeSec=%time:~6,2%
[insert timeout command]
if "%timeHrs%" geq 6 if "%timeHrs%" leq 9 [command to trigger Python script]
rem The above command is check if Hour is in 6-9 (in morning).
如果需要,您可以在下面复制代码(您可能还需要编辑代码):
If you want then you can copy code below (you might have to edit code as well):
@echo off
:loop
set timeHrs=%time:~0,2%
set timeMin=%time:~3,2%
set timeSec=%time:~6,2%
timeout /t 1500
if "%timeHrs%" geq 6 if "%timeHrs%" leq 9 [command to trigger Python script]
goto loop
您还希望在代码中添加出口,但我认为您不需要它,只需让代码每天运行即可.
You also want to add the exit in code as well, but I think you don't need it, just let the code run everyday.