I am creating a schedules task to run just before it's created and deleted after it runs.
I am using the tool, schtasks to create the scheduled task, but i havent found the parameter to run the task "At task creation/modification"
schtasks /create /TN "Install Bpm" /SC ONCE /TR "C:\windows\system32\calc.exe -i silent" /Z
My question is; how can I create a scheduled task via command line, with the trigger “At task creation/modification".
Best Answer
What you are asking for is really only available using the
AT
command, as it is designed to perform single-action tasks.You need to use the
/Create
to build the task from the command line.Then you need to
/Run
the task by its/TN
name.Once the task is complete, the task can call the
/Delete
command against its own/TN
name within the task to clean up after itself.