Tom*_*zko 21 windows command-line-interface scheduled-task batch-file
我可以像这样从命令行创建一个任务:
schtasks /create /tn SomeTask /tr "do.bat arg1 arg2" /sc ONCE /st 00:00:00 /sd 01/01/1991
Run Code Online (Sandbox Code Playgroud)
现在我需要删除它。但是该命令需要确认,我不知道如何从 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.
Run Code Online (Sandbox Code Playgroud)
问:如何删除定时任务并强制是?
qua*_*nta 24
C:\> schtasks /delete /tn ContextSwitchTask /f
Run Code Online (Sandbox Code Playgroud)