Executing a regularly scheduled script file

To execute the created script file on a regular basis, register it as a scheduled task in Windows.

The following procedure uses the Windows schtasks command to register the script files created in the example shown in Preparing a script file as tasks of Windows.

Registration example

Procedure

  1. Store the two script files in the C:\Reports folder.

C:\Reports
   CreateReport.bat
   DownloadReport.bat
  1. Run the Windows schtasks command to register the two script files as a task of Windows.

Make sure that the <Username for Windows> parameter of this command is a user who has write permissions to the following two folders.

schtasks /create /tn CreateReport /tr "C:\Reports\CreateReport.bat" /sc DAILY /st. 21:00:00 /ru <Username for Windows> /rp <Password for Windows> schtasks /create /tn DownloadReport /tr "C:\Reports\DownloadReport.bat" /sc DAILY /st 22:00:00 /ru <Username for Windows> /rp <Password for Windows>

  1. Run the schtasks /Query command to confirm that the Windows task is registered.

C:\>schtasks /Query
Task name      Time of next execution  Status
============= ====================== ===============
CreateReport   21:00:00, 2011/05/17
DownloadReport 22:00:00, 2011/05/17