0

如何在使用 AT 命令创建任务时定义作业的名称/ID?

4

2 回答 2

1

You can't specify an ID or name at creation with AT.

You can use SCHTASKS /CREATE to create a task and use the /TN switch to specify a task name, however. See here for more information: Schtasks @ MSDN

于 2011-06-25T14:21:17.097 回答
0

虽然您无法指定与 AT 命令一起使用的 ID,但您可以使用此脚本来识别您的 AT 计划任务正在使用的 ID,以便您可以从批处理文件中删除它(假设这是您的目标):

Set sCommand=ScheduledCommand.cmd

:LOOP
AT>AT.txt
findstr /I %sCommand% AT.txt>nul
If %ErrorLevel%==1 Goto CONTINUE
FOR /F %%i IN ('findstr /I %sCommand% AT.txt') DO (set ID=%%i)
AT %ID% /D
Goto LOOP

:CONTINUE
DEL AT.txt>nul

用法: 只需将 sCommand 设置为您已安排的命令的名称。

于 2015-08-13T12:06:40.150 回答