简体   繁体   中英

How do I create a scheduled task, via command line, which includes advanced options

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?

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.

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:

schtasks /delete /tn "My Task" 

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM