我可以从这样的命令行创建任务:
schtasks /create /tn SomeTask /tr "do.bat arg1 arg2" /sc ONCE /st 00:00:00 /sd 01/01/1991
现在我需要删除它。但是命令需要确认,我不知道如何从批处理文件 (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.
问题:如何删除计划任务并强制是?
答案1
C:\> schtasks /delete /tn ContextSwitchTask /f