如何通过命令行创建计划任务,其中包括高级选项
我正在尝试创建一个计划任务(在 WinXP 中),该任务每 10 分钟运行一次,每天从 16:00:00 到 06:00:00 从命令行运行。
目前,我可以使用以下命令创建一个每 10 分钟运行一次的计划任务,从每天 16:00:00 开始:
SCHTASKS.EXE /CREATE /SC MINUTE /MO 10 /TN "Scheduled task name" /ST 16:00:00 /SD 01/01/2000 /TR task.bat /RU SYSTEM
问题是,如何修改前面的命令,使其在 06:00 停止运行:00?
I'm trying to create a scheduled task (in WinXP) which runs every 10 minutes, starting at 16:00:00 to 06:00:00, daily, from the command line.
Currently, I can create a scheduled task which runs every 10 minutes, starting at 16:00:00, daily, by using the following command:
SCHTASKS.EXE /CREATE /SC MINUTE /MO 10 /TN "Scheduled task name" /ST 16:00:00 /SD 01/01/2000 /TR task.bat /RU SYSTEM
The question is, how do I modify the previous command so that it stops running at 06:00:00?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
由于似乎没有针对特定任务的停止时间的命令行开关,我认为您能做的最好的事情就是尝试为执行此任务的分配时间设置一个任务:
这应该从任务中删除该任务调度程序,并使其停止执行。我自己没有尝试过,所以我不知道它是否会杀死小猫。
http://technet.microsoft.com/en-us/library/bb490996。 ASPX
Since there doesn't appear to be a command line switch for the stop time of a particular task, I think the best you can do is try setting up a task for the allotted time that executes this:
which should remove the task from the task scheduler, and cause it to stop executing. I haven't tried this myself, so I don't know if it kills kittens or not.
http://technet.microsoft.com/en-us/library/bb490996.aspx
schtasks /change ... /disable 可以在 Vista/7/2003 中执行此操作。
xp不支持/disable
任务定义位于 C:\WINDOWS\Tasks 中,文件扩展名为“.job”
如果将“.job”文件重命名为其他名称(例如“.bozo”),它将无法运行
您可以将其重新命名为“.job”以重新启动它。
schtasks /change ... /disable can do this for Vista/7/2003.
xp does not support /disable
the task definitions reside in C:\WINDOWS\Tasks with the ".job" file extension
if you rename a ".job" file to something else such as ".bozo" it will not run
you can name it back to ".job" to restart it.
经过大量搜索,我找不到从命令行修改计划任务的方法。作为解决方法,我将每 10 分钟运行一次程序的责任推给了我的可执行文件,而让计划任务独自负责每天启动程序。
After much searching, I could find no way to modify the scheduled task from the command line. As a work around, I pushed the responsibility of running the program every 10 minutes to my executable, leaving the scheduled task the sole responsibility of kicking off the program daily.