我可以从命令行创建一个任务,如下所示:
schtasks /create /tn SomeTask /tr "do.bat arg1 arg2" /sc ONCE /st 00:00:00 /sd 01/01/1991
现在我需要删除它。但是该命令需要确认,我不知道如何从BATCH文件(bat / cmd)中执行此操作。
C:\> schtasks /delete /tn ContextSwitchTask
WARNING: Are you sure you want to remove the task "ContextSwitchTask" (Y/N)?
C:\> echo Y | schtasks /delete /tn ContextSwitchTask
WARNING: Are you sure you want to remove the task "ContextSwitchTask" (Y/N)? Y
ERROR: Invalid input.
Type "SCHTASKS /DELETE /?" for usage.
问题:如何删除预定任务并强制执行?