Windows at scheduler log

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.

Читайте также:  Windows 10 принтер hp 1536

/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.

Читайте также:  Whatsapp plus для windows phone

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.

Использование команды at для расписания задач

В этой статье описывается, как использовать команду для создания и отмены запланированных задач.

Исходная версия продукта: Windows 2000
Исходный номер КБ: 313565

Эта статья относится к Windows 2000. Поддержка Windows 2000 заканчивается 13 июля 2010 г. Дополнительные сведения см. в политике жизненного циклаподдержки Майкрософт.

Аннотация

В Windows 2000 для расписания задач можно использовать средство планивщика заданий в панели управления. Эту команду также можно использовать для расписания задач вручную.

Обзор команды

С помощью этой команды можно запланировать запуск команды, сценария или программы в заданную дату и время. Эту команду также можно использовать для просмотра существующих запланированных задач.

Чтобы использовать эту команду, должна быть запущена служба планировщика задач, и вы должны войти в систему как участник локальной группы администраторов. При использовании команды для создания задач необходимо настроить задачи так, чтобы они запускались в одной учетной записи пользователя.

Команда использует следующий синтаксис:

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

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

В следующем списке описываются параметры, которые можно использовать с командой:

\ имя компьютера: используйте этот параметр, чтобы указать удаленный компьютер. Если этот параметр не задан, задачи будут выполняться на локальном компьютере.

time: используйте этот параметр, чтобы указать время запуска задачи. Время определяется как часы: минуты на основе 24-часового времени. Например, 0:00 представляет полночь, а 20:30 — 20:30.

/interactive: используйте этот параметр, чтобы разрешить задаче взаимодействовать с рабочим столом пользователя, во время работы которого она вошел в систему.

/every: date. : используйте этот параметр, чтобы запланировать запуск задачи в указанный день или дни недели или месяца, например каждую пятницу или восьмую дату каждого месяца. Укажите дату как один или несколько дней недели (используйте следующие сокращения: M,T,W,Th,F,S,Su) или один или несколько дней месяца (используйте числа от 1 до 31). Убедитесь, что для разных записей даты используются запятые. Если этот параметр не задан, задача будет запланирована на текущий день.

/next: date, . Используйте этот параметр, чтобы запланировать запуск задачи в следующий день (например, следующий понедельник). Укажите дату как один или несколько дней недели (используйте следующие сокращения: M,T,W,Th,F,S,Su) или один или несколько дней месяца (используйте числа от 1 до 31). Убедитесь, что для раздельного использования нескольких записей даты используются запятые. Если этот параметр не задан, задача будет запланирована на текущий день.

команда: используйте этот параметр, чтобы указать команду Windows 2000, программу (EXE-файл или файл .com) или пакетную программу (файл BAT или CMD), которую требуется запустить. Если для команды в качестве аргумента требуется путь, используйте абсолютное имя пути (весь путь начинается с буквы диска). Если команда находится на удаленном компьютере, используйте имя пути UNC \ (ServerName \ ShareName). Если команда не является исполняемым файлом (EXE-файлом), необходимо перед cmd /c командой, например, cmd /c copy C:\*.* C:\temp .

id: используйте этот параметр, чтобы указать идентификационный номер, который назначен запланированной задаче.

/delete: используйте этот параметр для отмены запланированной задачи. Если опустить параметр id, все запланированные задачи на компьютере будут отменены.

Читайте также:  V380 pro для windows

/yes: используйте этот параметр, чтобы принудительно дать да на все запросы из системы при отмене запланированных задач. Если этот параметр не задан, вам будет предложено подтвердить отмену задачи.

При использовании команды запланированная задача будет запускаться с использованием учетных данных системной учетной записи.

Создание запланированного задания

Нажмите кнопку«Начните», выберите «Программы»,«Найдите «Дополнительные», а затем нажмите кнопку «Командная подсказка».

В командной области введите команду и нажмите ввод, чтобы отобразить список net start запущенных в настоящее время служб:

Если планщик задач не отображается в списке, введите следующую строку и нажмите ввод:

В командной строке введите следующую строку (используйте соответствующие ситуации параметры) и нажмите ввод:

Примеры

Чтобы скопировать все файлы из папки «Документы» в папку MyDocs в полночь, введите следующую строку и нажмите ввод:

Для этого необходимо 11:00 11:00. Каждый день недели создавайте пакетный файл, содержащий команды резервного копирования (например, Backup.bat), введите следующую строку и нажмите ввод, чтобы запланировать резервное копирование:

Чтобы запланировать запуск команды net share на сервере продаж в 6:00 чтобы перенаправить описание в файл Sales.txt в общей папке «Отчеты» на сервере Corp, введите следующую строку и нажмите ввод:

Отмена запланированной задачи

Нажмите кнопку«Начните», выберите «Программы»,«Найдите «Дополнительные», а затем нажмите кнопку «Командная подсказка».

В командной подсказке введите команду и нажмите ввод, чтобы отобразить список net start запущенных в настоящее время служб.

Если планщик задач не отображается в списке, введите следующую строку и нажмите ввод:

В командной строке введите следующую строку (используйте соответствующие ситуации параметры) и нажмите ввод:

Примеры отмены запланированных задач

  • Чтобы отменить все задачи, запланированные на локальном компьютере, введите at /delete и нажмите ввод.
  • Чтобы отменить задачу с именем 8 на компьютере с именем MyServer, введите at \\MyServer 8 /delete и нажмите ввод.

Просмотр запланированных задач

Чтобы просмотреть задачи, созданные с помощью команды, выполните следующие действия:

Нажмите кнопку«Начните», выберите «Программы»,«Найдите «Дополнительные», а затем нажмите кнопку «Командная подсказка».

В командной подсказке введите команду и нажмите ввод, чтобы отобразить список net start запущенных в настоящее время служб.

Если планщик задач не отображается в списке, введите следующую строку и нажмите ввод:

В командной области сделайте одно из следующих действий:

  • Чтобы просмотреть список задач, запланированных с помощью команды, введите строку at \\computername и нажмите ввод.
  • Чтобы просмотреть определенную запланированную задачу, введите at \\computername id команду и нажмите ввод.

Примеры просмотра запланированных задач

  • Чтобы просмотреть все запланированные задачи на локальном компьютере, введите at и нажмите ввод.
  • Чтобы просмотреть все запланированные задачи на компьютере с именем «Поддержка», введите at \\support и нажмите ввод.
  • Чтобы просмотреть задачу с ид 18 на локальном компьютере, введите at 18 и нажмите ввод.

Устранение неполадок

При введите для просмотра списка запланированных задач некоторые (или все) запланированные задачи, созданные с помощью команды, не будут at \\computername перечислены.

Это может произойти, если вы изменили задачи в папке «Запланированные задачи» после использования команды для создания задачи. При использовании команды при расписании задачи она отображается в папке «Запланированные задачи» панели управления. Задачу можно просмотреть или изменить. Однако при изменении задачи при использовании команды ее нельзя просмотреть.

При использовании указанной команды для расписания задачи задача не будет запускаться в указанное время или дату.

Такое поведение может произойти, если верно одно из следующих условий:

Синтаксис команды неправильный.

После расписания задачи введите, чтобы подтвердить правильность at \\computername синтаксиса. Если информация, отображаемая в командной строке, неправильная, отмените задачу, а затем воссоздаем ее.

Задание запланировать на запуск команды, которая не является EXE-файлом.

Перед запуском команд команда не загружает командный командный автомат (интерпретатор команды). Если вы не работаете с EXE-файлом, необходимо загрузить Cmd.exe в начале команды, например at cmd /c dir > c:\test.txt .

Ссылки

Дополнительные сведения об использовании команды at в Windows 2000 см. в справке windows 2000. Для этого нажмите кнопку «Начните», выберите «Справка», щелкните вкладку «Индекс» и введите команду.

Оцените статью