title: Windows 10 Schtasks.exe Delete After Final Run Error
body: <p>I am attempting to use <a href="https://docs.microsoft.com/en-us/windows/desktop/taskschd/schtasks" rel="nofollow noreferrer"><code>schtasks</code></a> to run a once off task that will simply execute a program. Here is what it looks like:</p>
  
  <pre><code>schtasks /Create /SC ONCE /TN "OpenCalc" /TR "C:\Windows\System32\calc.exe" /ST "11:59" /SD "09/12/2018"
  </code></pre>
  
  <p>This works. It creates a task (can be seen in Windows Task Scheduler), and it executes.</p>
  
  <p>I want this task to delete itself after its one execution, so I add the following:</p>
  
  <pre><code>/Z
  
  A value that marks the task to be deleted after its final 
  </code></pre>
  
  <p>Now my command is:</p>
  
  <pre><code>schtasks /Create /SC ONCE /TN "OpenCalc" /TR "C:\Windows\System32\calc.exe" /ST "11:59" /SD "09/12/2018" /Z
  </code></pre>
  
  <p>However, now I get the following error:</p>
  
  <pre><code>ERROR: The task XML is missing a required element or attribute.
  (40,4):EndBoundary:
  </code></pre>
  
  <hr>
  
  <p>The <a href="https://docs.microsoft.com/en-us/windows/desktop/taskschd/schtasks" rel="nofollow noreferrer">documentation</a> would lead me to believe the <code>/Z</code> switch has nothing to do with the <code>/XML</code> parameter, but maybe this is not the case. Am I missing something here?</p>