schtasks - create task with no schedule that runs on demand

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


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"