Windows at command interactive

Команда AT — управление планировщиком заданий из командной строки.

Команда AT применяется для управления Планировщиком заданий из командной строки Windows. Позволяет создавать новые задания, отменять или изменять существующие для локального или удаленного компьютера. В операционных системах Windows Vista и старше, команда AT поддерживается не в полном объеме, по соображениям безопасности. Для получения полной функциональности планировщика заданий в среде Windows Vista\Windows 7 и старше рекомендуется использовать вместо команды AT утилиту командной строки SCHTASKS

Формат командной строки:

AT [\\имя_компьютера] [ [ИД] [/DELETE] | /DELETE [/YES]]

AT [\\имя_компьютера] время [/INTERACTIVE] /EVERY:день[. ] | /NEXT:день[. ]] «команда»

\\имя_компьютера — Имя удаленного компьютера. Если этот параметр опущен, используется локальный компьютер.

код — Порядковый номер запланированной задачи.

/delete — Отмена запланированной задачи. Если код задачи опущен, отменяются все задачи, запланированные для указанного компьютера.

/yes — Отмена запроса на подтверждение при отмене всех запланированных задач.

время — Время запуска команды.

/interactive — Разрешение взаимодействия задачи с пользователем, работающим на компьютере во время запуска задачи. Если данный ключ не задан, то задача выполняется невидимо для пользователя.

/every:день[. ] — Запуск задачи осуществляется по указанным дням недели или месяца. Если дата опущена, используется текущий день месяца.

/next:день[. ] — Задача будет запущена в следующий указанный день недели (например, в следующий четверг). Если дата опущена, используется текущий день месяца.

«команда» — Команда Windows или имя пакетного файла.

at — отобразить список всех задач, запланированных для выполнения на данном компьютере.

at \\COMP1 — отобразить список всех задач, запланированных для выполнения на компьютере с именем COMP1.

at 14:15 /INTERACTIVE /EVERY:1 cmd.exe — В 14:15 каждого 1-го числа каждого месяца выполнять задачу CMD.EXE в интерактивном режиме (в режиме взаимодействия с рабочим столом, т.е. видимую для пользователя.

at 14:15 /INTERACTIVE /EVERY:sunday cmd.exe — В 14:15 каждого воскресенья ( sunday ) выполнять запуск CMD.EXE

at 14:15 /INTERACTIVE /NEXT:monday cmd.exe — В следующий понедельник ( monday ), в 14:15 запустить задачу CMD.EXE

at 14:15 /interactive /next:monday «C:\Program Files\FAR\far.exe» — то же самое, но с указанием пути исполняемого файла. Имена файлов и каталогов, содержащие пробелы, должны заключаться в двойные кавычки.

at 3 /DELETE — удалить задачу под номером 3. Номер запланированной задачи отображается при выполнении команды на отображение списка задач ( AT без параметров)

Для работы с планировщиком задач из командной строки можно также использовать команду SCHTASKS , предоставляющую более широкие возможности по управлению заданиями на локальной или удаленной системе.

MS-DOS and Windows command line at command

The at command enables users to schedule tasks to be performed at a specified time and date.

Availability

At is an external command that is available for the following Microsoft operating systems as the at.exe file.

With Windows Vista, Windows 7, Windows 8, and newer versions, the at command is deprecated; use the schtasks command instead.

At syntax

The AT command schedules commands and programs to run on a computer at a specified time and date. The Schedule service must be running to use the AT command.

\\computername Specifies a remote computer. Commands are scheduled on the
local computer if this parameter is omitted.
id Is an identification number assigned to a scheduled command.
/delete Cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled.
/yes Used with cancel all jobs command when no further confirmation is desired.
time Specifies the time when command is to run.
/interactive Allows the job to interact with the desktop of the user who is logged on at the time the job runs.
/every:date[. ] Runs the command on each specified day(s) of the week or month. If date is omitted, the current day of the month is assumed.
/next:date[. ] Runs the specified command on the next occurrence of the day (for example, next Thursday). If date is omitted, the current day of the month is assumed.
«command» Is the Windows NT command, or batch program to run.

At examples

Performing this command would run the task.bat file at 6:50PM today unless the task is scheduled after the time specified. Because the /interactive switch is not in the command, this batch file will be executed in the background.

Runs the beep.bat batch file at 6:50PM with the ability for the user to interact with the batch file.

Deletes the at ID 1.

Delete all AT IDs.

Typing at alone displays each of the scheduled tasks, their status, id, scheduled time, and command.

Typing at followed by an ID number displays additional information about the task id as shown below.

Windows at command interactive

Applies to: Windows Server (Semi-Annual Channel), Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012

Schedules commands and programs to run on a computer at a specified time and date. You can use at only when the Schedule service is running. Used without parameters, at lists scheduled commands. You must be a member of the local Administrators group to run this command.

Читайте также:  Windows dos prompt commands

Syntax

Parameters

Parameter Description
\ Specifies a remote computer. If you omit this parameter, at schedules the commands and programs on the local computer.
Specifies the identification number assigned to a scheduled command.
/delete Cancels a scheduled command. If you omit ID, all of the scheduled commands on the computer are canceled.
/yes Answers yes to all queries from the system when you delete scheduled events.
Specifies the time when you want to run the command. time is expressed as Hours:Minutes in 24-hour notation (that is, 00:00 (midnight) through 23:59).
interactive Allows command to interact with the desktop of the user who is logged on at the time Command runs.
every: Runs command on every specified day or days of the week or month (for example, every Thursday, or the third day of every month).
Specifies the date when you want to run the command. You can specify one or more days of the week (that is, type M,T,W,Th,F,S,Su) or one or more days of the month (that is, type 1 through 31). Separate multiple date entries with commas. If you omit date, at uses the current day of the month.
next: Runs command on the next occurrence of the day (for example, next Thursday).
Specifies the Windows command, program (that is, .exe or .com file), or batch program (that is, .bat or .cmd file) that you want to run. When the command requires a path as an argument, use the absolute path (that is, the entire path beginning with the drive letter). If the command is on a remote computer, specify Universal Naming Convention (UNC) notation for the server and share name, rather than a remote drive letter.
/? Displays help at the command prompt.

Remarks

This command doesn’t automatically load cmd.exe before running commands. If you’re not running an executable (.exe) file, you must explicitly load cmd.exe at the beginning of the command as follows:

If using this command without command-line options, scheduled tasks appear in a table formatted similar to the following:

If including an identification number (ID) with this command, only information for a single entry appears in a format similar to the following:

After you schedule a command, especially a command that has command-line options, check that the command syntax is correct by typing at without any command-line options. If the information in the Command Line column is wrong, delete the command and retype it. If it’s still incorrect, retype the command using fewer command-line options.

Commands scheduled with at run as background processes. Output is not displayed on the computer screen. To redirect output to a file, use the redirection symbol > . If you redirect output to a file, you need to use the escape symbol ^ before the redirection symbol, whether you are using at at the command line or in a batch file. For example, to redirect output to output.txt, type:

The current directory for the executing command is the systemroot folder.

If you change the system time after you schedule a command to run, synchronize the at scheduler with the revised system time by typing at without command-line options.

Scheduled commands are stored in the registry. As a result, you don’t lose scheduled tasks if you restart the Schedule service.

Do not use a redirected drive for scheduled jobs that access the network. The Schedule service might not be able to access the redirected drive, or the redirected drive might not be present if a different user is logged on at the time the scheduled task runs. Instead, use UNC paths for scheduled jobs. For example:

Do not use the following syntax, where x: is a connection made by the user:

If you schedule an at command that uses a drive letter to connect to a shared directory, include an at command to disconnect the drive when you are finished using the drive. If the drive is not disconnected, the assigned drive letter won’t be available at the command prompt.

By default, tasks scheduled using this command will stop after 72 hours. You can modify the registry to change this default value.

To modify the registry

Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.

Start the registry editor (regedit.exe).

Locate and click the following key in the registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Schedule

On the Edit menu, click Add Value, and then add the following registry values:

Value Name. atTaskMaxHours

Data type. reg_DWOrd

Radix. Decimal

Value Data: 0. A value of 0 in the Value Data field indicates no limit and doesn’t not stop. Values from 1 through 99 indicates the number of hours.

You can use the Scheduled Tasks folder to view or modify the settings of a task that was created by using this command. When you schedule a task using this command, the task is listed in the Scheduled Tasks folder, with a name such as the following:at3478. However, if you modify a task through the Scheduled Tasks folder, it’s upgraded to a normal scheduled task. The task is no longer visible to the at command, and the at account setting no longer applies to it. You must explicitly enter a user account and password for the task.

Examples

To display a list of commands scheduled on the Marketing server, type:

To learn more about a command with the identification number 3 on the Corp server, type:

To schedule a net share command to run on the Corp server at 8:00 A.M. and redirect the listing to the Maintenance server, in the Reports shared directory, and the Corp.txt file, type:

To back up the hard drive of the Marketing server to a tape drive at midnight every five days, create a batch program called Archive.cmd, which contains the backup commands, and then schedule the batch program to run, type:

To cancel all commands scheduled on the current server, clear the at schedule information as follows:

To run a command that is not an executable (.exe) file, precede the command with cmd /c to load cmd.exe as follows:

Additional References

schtasks. Another command-line scheduling tool.

Use the at command to schedule tasks

This article describes how to use the at command to create and to cancel scheduled tasks.

Original product version: В Windows 2000
Original KB number: В 313565

This article applies to Windows 2000. Support for Windows 2000 ends on July 13, 2010. For more information, see the Microsoft Support Lifecycle Policy.

Summary

In Windows 2000, you can use the Task Scheduler tool in Control Panel to schedule tasks. You can also use the at command to schedule tasks manually.

Overview of the at command

You can use the at command to schedule a command, a script, or a program to run at a specified date and time. You can also use this command to view existing scheduled tasks.

To use the at command, the Task Scheduler service must be running, and you must be logged on as a member of the local Administrators group. When you use the at command to create tasks, you must configure the tasks so that they run in the same user account.

The at command uses the following syntax:

at \\computername time/interactive | /every: date, . /next: date, . command

at \\computername id/delete | /delete /yes

The following list describes the parameters that you can use with the at command:

\computername: Use this parameter to specify a remote computer. If you omit this parameter, tasks are scheduled to run on the local computer.

time: Use this parameter to specify the time when the task is to run. Time is specified as hours: minutes based on the 24-hour clock. For example, 0:00 represents midnight and 20:30 represents 8:30 P.M.

/interactive: Use this parameter to allow the task to interact with the desktop of the user who is logged on at the time the task runs.

/every: date. : Use this parameter to schedule the task to run on the specified day or days of the week or month, for example, every Friday or the eighth day of every month. Specify date as one or more days of the week (use the following abbreviations: M,T,W,Th,F,S,Su) or one or more days of the month (use the numbers 1 through 31). Make sure that you use commas to separate multiple date entries. If you omit this parameter, the task is scheduled to run on the current day.

/next: date, . Use this parameter to schedule the task to run on the next occurrence of the day (for example, next Monday). Specify date as one or more days of the week (use the following abbreviations: M,T,W,Th,F,S,Su) or one or more days of the month (use the numbers 1 through 31). Make sure that you use commas to separate multiple date entries. If you omit this parameter, the task is scheduled to run on the current day.

command: Use this parameter to specify the Windows 2000 command, the program (.exe or .com file), or the batch program (.bat or .cmd file) that you want to run. If the command requires a path as an argument, use the absolute path name (the entire path beginning with the drive letter). If the command is on a remote computer, use the Uniform Naming Convention (UNC) path name (\ServerName\ ShareName). If the command is not an executable (.exe) file, you must precede the command with cmd /c , for example, cmd /c copy C:\*.* C:\temp .

id: Use this parameter to specify the identification number that is assigned to a scheduled task.

/delete: Use this parameter to cancel a scheduled task. If you omit the id parameter, all scheduled tasks on the computer are canceled.

/yes: Use this parameter to force a yes answer to all queries from the system when you cancel scheduled tasks. If you omit this parameter, you are prompted to confirm the cancellation of a task.

When you use the at command, the scheduled task is run by using the credentials of the system account.

Create a scheduled task

Click Start, point to Programs, point to Accessories, and then click Command Prompt.

At the command prompt, type the net start command, and then press ENTER to display a list of currently running services:

If Task Scheduler is not displayed in the list, type the following line, and then press ENTER:

At the command prompt, type the following line (use the parameters that are appropriate to your situation), and then press ENTER:

Examples

To copy all files from the Documents folder to the MyDocs folder at midnight, type the following line, and then press ENTER:

To back up the Products server at 11:00 P.M. each weekday, create a batch file that contains the backup commands (for example, Backup.bat), type the following line, and then press ENTER to schedule the backup:

To schedule a net share command to run on the Sales server at 6:00 A.M. and to redirect the listing to the Sales.txt file in the shared Reports folder on the Corp server, type the following line, and then press ENTER:

Cancel a scheduled task

Click Start, point to Programs, point to Accessories, and then click Command Prompt.

At the command prompt, type the net start command, and then press ENTER to display a list of currently running services.

If Task Scheduler is not displayed in the list, type the following line, and then press ENTER:

At the command prompt, type the following line (use the parameters that are appropriate to your situation), and then press ENTER:

Examples to cancel scheduled tasks

  • To cancel all tasks that are scheduled on the local computer, type at /delete , and then press ENTER.
  • To cancel the task ID 8 on a computer that is named MyServer, type at \\MyServer 8 /delete , and then press ENTER.

View scheduled tasks

To view the tasks that you created by using the at command, follow these steps:

Click Start, point to Programs, point to Accessories, and then click Command Prompt.

At the command prompt, type the net start command, and then press ENTER to display a list of currently running services.

If Task Scheduler is not displayed in the list, type the following line, and then press ENTER:

At the command prompt, do one of the following steps:

  • To view a list of tasks that you scheduled by using the at command, type the at \\computername line, and then press ENTER.
  • To view a specific scheduled task, type the at \\computername id command, and then press ENTER.

Examples to view scheduled tasks

  • To view all scheduled tasks on the local computer, type at , and then press ENTER.
  • To view all scheduled tasks on a computer named Support, type at \\support , and then press ENTER.
  • To view the task ID 18 on the local computer, type at 18 , and then press ENTER.

Troubleshooting

When you type at \\computername to view a list of scheduled tasks, some (or all) of the scheduled tasks that you created by using the at command are not listed.

This behavior can occur if you modified the tasks in the Scheduled Tasks folder after you used the at command to create the task. When you use the at command to schedule a task, the task is displayed in the Scheduled Tasks folder in Control Panel. You can view or modify the task. However, if you modify the task, when you use the at command, you cannot view the task.

When you use the at command to schedule a task, the task does not run at the specified time or date.

This behavior can occur if one of the following conditions is true:

The command syntax is incorrect.

After you schedule a task, type at \\computername to confirm that the syntax is correct. If the information that is displayed under Command Line is incorrect, cancel the task, and then recreate it.

You schedule a task to run a command that is not a .exe file.

The at command does not automatically load cmd (the command interpreter) before it runs commands. Unless you are running a .exe file, you must load Cmd.exe at the beginning of the command, for example, at cmd /c dir > c:\test.txt .

References

For more information about how to use the at command in Windows 2000, see Windows 2000 Help. To do so, click Start, click Help, click the Index tab, and then type at command.

Читайте также:  Habrahabr windows 10 обновление
Оцените статью