Link to home
Start Free TrialLog in
Avatar of tfsaccount
tfsaccountFlag for United States of America

asked on

schtasks - single task, multiple dates

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!



ASKER CERTIFIED SOLUTION
Avatar of tfsaccount
tfsaccount
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial