开发者

How to define a Job ID when using the AT command

开发者 https://www.devze.com 2023-03-15 14:26 出处:网络
How is it p开发者_StackOverflow中文版ossible to define the name / ID of a job whilst creating a task with the AT command?You can\'t specify an ID or name at creation with AT.

How is it p开发者_StackOverflow中文版ossible to define the name / ID of a job whilst creating a task with the AT command?


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


While you can't specify the ID that is used with the AT command, you can use this script to identify the ID that your AT scheduled task is using so you can delete it from a batch file (assuming that is your objective):

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

Usage: Simply set sCommand to the name of the command that you have scheduled.

0

精彩评论

暂无评论...
验证码 换一张
取 消