如何从命令行删除计划任务而不进行确认?(schtasks删除)


17

我可以从命令行创建一个任务,如下所示:

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.

问题:如何删除预定任务并强制执行?

Answers:


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.