I am trying to use schtasks.exe and create a one-time task that runs on demand. I just want to create the task without a schedule but the command schtasks /create /tn TestTask fails with Invalid syntax. Mandatory option 'sc' is missing.. Is there an option i am missing ?

5 Answers 5


Create the task and set it to start ONCE in the past. The task will exist and you can run it at will.

  • 1
    This does not work on my machine - any other workaround you know of? We scheduled the task with ONCE on 1/1/2999, however, that's not a clean solution.
    – D.R.
    Jul 2, 2015 at 13:42
  • 2
    @D.R. We have a time traveler! For the rest of us, 1/1/2999 is not in the past. It's also after January 19, 2038 03:14:08 GMT, The End of Unix Time. That's why it didn't work on your machine. May 9, 2017 at 16:04

Instead of using a dummy time in the past or future, you can set the task to run on a dummy event:

SCHTASKS /Create /TN TaskOnEvent /TR notepad.exe /SC ONEVENT /EC Application /MO *[System/EventID=777] /f

Then you can run it on demand:

SCHTASKS /Run /TN "TaskOnEvent"

Or trigger it by logging the event:

EVENTCREATE /ID 777 /L APPLICATION /T INFORMATION /SO DummyEvent /D "Initiate scheduled task."

..Or create task in gui, export and call xml:

SCHTASKS /Create /TN "TaskOnEvent" /xml "C:\TaskOnEvent.xml"

/sc ONCE /st 00:00 should be sufficient to create a task that never triggers by its own and needs to be triggered explicitly


As mentioned already you can create task in gui, export and call xml:

SCHTASKS /Create /TN "TaskOnEvent" /xml "C:\TaskOnEvent.xml"

...You do NOT have to specify any triggers if you create via the GUI.


/sc once /st 00:00 will not work because you can't schedule a task in the past. But if you use the the CURRENT TIME, it will work, and the task will never be executed ... (but you'll get a warning though) .... tested under Windows 10 ...

/sc once /st 20:56for this post !

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .