Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

schtasks - single task, multiple dates

Posted on 2011-03-10
1
Medium Priority
?
1,160 Views
Last Modified: 2012-05-11
Ok, riddle me this riddler!!!

Short story
I need a non-GUI method of creating a SINGLE task that runs on multiple dates/times, but the dates are non-standard (based on fiscal periods, so I would specify the dates).  This could be some type of xml, or a single line that with a bevy of parameters, or multiple lines, or whatever, but I dont want it to use the gui... all through the command line.

I know it can be done using the GUI... I've done it, but I need a way to automate this process.  I can create code that will create the script (or xml file or whatever) and I then save that script and run it when needed.

Long version
Lets say I have a program called "RunMe.exe" that accepts a parameter... so when I call it I will call it as "RunMe.exe 7" where 7 is the parameter.

My company does things in fiscal periods and I want Windows Scheduler to run this task at the start of every fiscal period (I have the fiscal lists, I dont need any method of calculating or pulling them automatically) at 10am

For this question.. without using the GUI, how can I create a schedule so that the task will run at 10am on May 1 2011, June 12, 2011, July 3 2011?

I already have the code to create tasks that run every monday and things like that, but I dont know how to do it for these fiscal periods.

I do NOT want a task for each fiscal period... so I dont want to look in the scheduler and see a bunch of tasks, such as:

"RunMe.exe 7" May 1
"RunMe.exe 7" June 12
"RunMe.exe 7" July 3

I want to open up the Windows Scheduler and see a single task, lets call it RunMe.  When I click on that task and go to the Schedule tab, I can see the list of dates(and times) that this task will run on.

I need something that looks like (which will run every day at 5:50am)
schtasks /create /s vServer1 /tn "RunMe 7" /tr "C:\SomeProgramDir\RunMe.exe 7" /sc weekly /d MON,TUE,WED,THU,FRI,SAT,SUN /st 05:50

I dont care if there are 3 lines.. the first line creates the initial task with date/time and the next two lines modify (or add or wahtever) the schedules dates to add the other two dates... or even an XML file or anything.

All I care is that when I am done running the single line, or 3 lines, or single line + xml or however its done, I have a single task with multiple different dates that I specify.

Is this possible at all or MUST it be done using the GUI?  I dont want to have to purchase any new schedulers or anything like that.  If it can NOT be done using the built-in Windows Scheduler, is there a free/safe/reliable windows scheduler replacement that I can use?  A different scheduler would only be my very last resort.

Thanks!



0
Comment
Question by:tfsaccount
1 Comment
 
LVL 1

Accepted Solution

by:
tfsaccount earned 0 total points
ID: 35096335
Ok, I figured this one out:
1) Go and use the GUI to manually create a task with some dates that you select manually
2) Export this into an XML file
3) Open up the XML file and change the dates to what you need
4) Use the /create and /xml options to create a new task with the dates specified in the XML file

Not the funnest method, but it works and I can save the XML file to use later on, all I need to do is change the times and the arguments and a few things like that.

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

So you have two Windows Servers and you have a directory/folder/files on one that you'd like to mirror to the other?  You don't really want to deal with DFS or a 3rd party solution like Doubletake. You can use Robocopy from the Windows Server 200…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question