Saturday, February 14, 2009

How to Create a Scheduled Task


  1. Click Start, point to Programs, point to Accessories, and then click Command Prompt.
  2. At the command prompt, type the following line, and then press ENTER to display a list of currently running services:
    net start
    If Task Scheduler is not displayed in the list, type the following line, and then press ENTER:
    net start "task scheduler"
  3. At the command prompt, type the following line (use the parameters that are appropriate to your situation), and then press ENTER:
    at \\computername time /interactive | /every:date,... /next:date,... command

Examples

  • To copy all files from the Documents folder to the MyDocs folder at midnight, type the following line, and then press ENTER:
    at 00:00 cmd /c copy C:\Documents\*.* C:\MyDocs
  • 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:
    at \\products 23:00 /every:M,T,W,Th,F 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:
    at \\sales 06:00 cmd /c "net share reports=d:\Documents\reports >> \\corp\reports\sales.txt"

How to Cancel a Scheduled Task

  1. Click Start, point to Programs, point to Accessories, and then click Command Prompt.
  2. At the command prompt, type the following line, and then press ENTER to display a list of currently running services:
    net start
    If Task Scheduler is not displayed in the list, type the following line, and then press ENTER:
    net start "task scheduler"
  3. At the command prompt, type the following line (use the parameters that are appropriate to your situation), and then press ENTER:
    at \\computername id /delete | /delete/yes

Examples

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

How to View Scheduled Tasks

To view the tasks that you created by using the at command, follow these steps:
  1. Click Start, point to Programs, point to Accessories, and then click Command Prompt.
  2. At the command prompt, type the following line, and then press ENTER to display a list of currently running services:
    net start
    If Task Scheduler is not displayed in the list, type the following line, and then press ENTER:
    net start "task scheduler"
  3. 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 following line, and then press ENTER:
      at \\computername
      -or-

    • To view a specific scheduled task, type the following line, and then press ENTER:
      at \\computername id

Examples

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

No comments: