Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows任务计划程序-非重复仅在时间窗口期间运行_Windows_Scheduled Tasks - Fatal编程技术网

Windows任务计划程序-非重复仅在时间窗口期间运行

Windows任务计划程序-非重复仅在时间窗口期间运行,windows,scheduled-tasks,Windows,Scheduled Tasks,我设置了一个由工作站解锁触发的非重复任务。我如何调节它,使其仅在一天中的特定时间段内运行?比如早上8点到10点之间 之前有一个答案,但该解决方案只能用于重复任务 我希望得到一个答案,回来时什么也没有,但因为我非常需要一个,所以我自己找到了。这个过程总是让我感到惊讶 您需要使用IF命令通过批处理文件执行任务。代码如下: @ECHO OFF :: For using just the hour digit of 'time' variable SET hour=%time:~0,2% :: Let

我设置了一个由工作站解锁触发的非重复任务。我如何调节它,使其仅在一天中的特定时间段内运行?比如早上8点到10点之间


之前有一个答案,但该解决方案只能用于重复任务

我希望得到一个答案,回来时什么也没有,但因为我非常需要一个,所以我自己找到了。这个过程总是让我感到惊讶

您需要使用
IF
命令通过批处理文件执行任务。代码如下:

@ECHO OFF
:: For using just the hour digit of 'time' variable
SET hour=%time:~0,2%

:: Let's say I want whatever it is to run only when I'm unlocking the station between 8-10 A.M.
IF %hour% GEQ 8 IF %hour% LEQ 10 (GOTO RUNIT)

GOTO END

:RUNIT
:: Put your commands here, I want to open a bunch of text files I'm working on.
start notepad "D:\file1.txt"
start notepad "D:\file2.txt"

:END
工作起来很有魅力。现在,这些文件不会在我每次回到笔记本电脑并登录时打开