I am trying to create a schedule task using command line which has multiple actions running more than one batch files in sequence among other things
SCHTASKS /Create /TN TaskName /SC ONLOGON
/TR C:\ost\sanAuto.bat
/TR C:\ost\ClEvtLog.cmd
What I have tried that didn't work:
SCHTASKS /Create /TN tsk /SC ONLOGON /TR "C:\sanAuto.bat","C:\ClEvtLog.cmd"
this one create single action to run a program as "C:\sanAuto.bat","C:\ClEvtLog.cmd"
SCHTASKS /Create /TN tsk /SC ONLOGON /TR "C:\sanAuto.bat" /TN "C:\ClEvtLog.cmd"
This one says multiple /TN not allowed
Is there a way to create tasks from command line and specify multiple actions?
Note 1 Exporting and importing the xml is not something i want to do http://iislogs.com/steveschofield/2009/03/20/creating-a-scheduled-task-with-multiple-actions-using-command-line-in-windows-server-2008/
TR
is not "TRigger", it's "Task (to) Run" (a Trigger is what starts the task, which isSC
("Schedule") from the command-line).TN
= Task Name, each task can only have one name (your third example).start
and/orcall
when calling batch files from batch files. Also, if you're using Windows 8/Server 2012+ you can also maybe look into using PowerShell to create your tasks. Not sure if it'll let you assign multiple actions or not (off-hand).