Mini123 Posted July 19, 2006 Share Posted July 19, 2006 Me again, I have a scheduled task to run at 09:00 Monday - FridaySay i have a day off and i dont want it to run is there a VB or a shortcut or something that i can click that will skip todays scanning and let it continue as normal the next dayThanks Link to comment Share on other sites More sharing options...
aquarius Posted July 19, 2006 Share Posted July 19, 2006 Someone might know how to change the next execution schedule of a job, but this works as well:(So simple I'm allmost embarrased but I'm lazy and it works :-)I usually make a temporary file, e.g. C:\temp\skipjob.flg or whatever, and make the scheduled program check if it exists. If it exists, delete it and exit. Next time it will run as normal. The schedule has not been changed, just the behaviour of the program.Make a small script that justs creates this little "flag file" when you need it.(Change your program to accept an argument, for example /skip, to tell it to create the flag and exit, if you don't want more scripts in your folder. )If you want it to skip the job until you are back from a holiday, just check for existence, but don't remove the flag. Then you remove it when you are ready. Link to comment Share on other sites More sharing options...
Mini123 Posted July 19, 2006 Author Share Posted July 19, 2006 Will this stop tasks that are in Windows own Scheduled Task Program? Link to comment Share on other sites More sharing options...
aquarius Posted July 19, 2006 Share Posted July 19, 2006 (edited) Nah, this idea was not to stop the task starting, but to edit it, enabling it to exit without doing anything (skip), but yes, it works with scripts started from Task Scheduler. (The tasks I put in servers Task Scheduler is normally specialized batch programs or vbs/js scripts I create myself.)This strategy gives you complete control over which tasks will run and which don't (skips), without having to change the Schedule Task properties programatically, which might be complicated. (You can use the AT command instead which is easy to control from batch programs, but lack the more advanced options)Maybe you want to stop all tasks. You can do that by stopping the schedule service, which will of course stop all scheduled tasks while you are away.The scheduler service is named slightly differently in different OS'es, but assuming XP:net stop "Task Scheduler"When you are back and want to resume the tasks, net start "Task Scheduler"So I have three strategies for you, depending on your needs:To stop all tasks: stop the scheduler service temporarilyTo stop not all, but just a few tasks in the form of editable scripts: Add the "skip once" strategy to the script(s) (no change in the schedules)Or use the at command Edit: Maybe it's not easy to use the at command from a script to change a schedule, but it's doable. You can't set next execution date, but knowing the ID of the job, you can delete the schedule, and you can have the script reschedule itself later.You could find the current ID of a task by using FOR, AT and FIND. To stop the job with ID 1: at 1 /delete Edited July 20, 2006 by aquarius Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now