I am attempting to use schtasks
to run a once off task that will simply execute a program. Here is what it looks like:
schtasks /Create /SC ONCE /TN "OpenCalc" /TR "C:\Windows\System32\calc.exe" /ST "11:59" /SD "09/12/2018"
This works. It creates a task (can be seen in Windows Task Scheduler), and it executes.
I want this task to delete itself after its one execution, so I add the following:
/Z
A value that marks the task to be deleted after its final
Now my command is:
schtasks /Create /SC ONCE /TN "OpenCalc" /TR "C:\Windows\System32\calc.exe" /ST "11:59" /SD "09/12/2018" /Z
However, now I get the following error:
ERROR: The task XML is missing a required element or attribute.
(40,4):EndBoundary:
The documentation would lead me to believe the /Z
switch has nothing to do with the /XML
parameter, but maybe this is not the case. Am I missing something here?