Run Schedule Task on Windows
7 Steps to configuring your Schedule Task on Microsoft Windows
This post will go over the steps to schedule a task on Windows. Microsoft Windows provides a Task Scheduler which can be configured to invoke or run a process, script or a task for a specified condition. The task can be specified to run at a particular time, Weekly, Daily, Monthly, or when user logs into the computer, boot up time etc. Tasks can be repeated or delayed as required. You can automate several tasks with the Windows Scheduler that can be run at a specified event or time.
Follow each of the 7 steps below to configure your Scheduled Task.
The screenshots with 7 steps are shown below are for creating a Task. The task is invoked at a particular time or when an event occurs. At the particular time or when the event occurs, the task is trigger by the Scheduler.
Step 1: How to Access Task Scheduler
To access the Task Scheduler, open the Control Panel, it is under Administrative Tools. Follow the path
Control Panel >> System and Security >> Administrative Tools >> Task Scheduler
Step 2: Click on Task Scheduler, go to Actions tab and click on "Create Task"
For this post, Create Task was chosen as below. If you click Basic Task it will open a wizard, however for both options you will be configuring the same information. See below screenshots.
Step 3: General Tab
Follow each of the 7 steps below to configure your Scheduled Task.
The screenshots with 7 steps are shown below are for creating a Task. The task is invoked at a particular time or when an event occurs. At the particular time or when the event occurs, the task is trigger by the Scheduler.
Step 1: How to Access Task Scheduler
To access the Task Scheduler, open the Control Panel, it is under Administrative Tools. Follow the path
Control Panel >> System and Security >> Administrative Tools >> Task Scheduler
Step 2: Click on Task Scheduler, go to Actions tab and click on "Create Task"
For this post, Create Task was chosen as below. If you click Basic Task it will open a wizard, however for both options you will be configuring the same information. See below screenshots.
Step 3: General Tab
The first tab is the General Tab for providing basic info and name of the Task
The below settings for “Run with highest privileges” or
Configure for Windows7 or Windows 10 did not matter. (either way, checked on unchecked worked fine)
Step4 : Triggers Tab
In this Tab you configure when you want the task to be triggered or started automatically. This tab is only for setting the scheduled time of the task
Step 5: Actions Tab (shows the script to be
called or action to be performed)
Make sure to specify the “Start in” parameter. This is
required on a Windows 10. (Even though this is optional, the task did not run until the "Start in" was specified). Specify the directory where your script is located. This script or program will be invoked or run at the scheduled time or when the event is triggered.
The
Start in parameter had to be specified, else the task did not run
Step 6: Conditions Tab
In this Tab you can specify any of the above conditions for the task to start or invoked
Step 7: Settings (has various Task behaviors that can be configured)
History (currently disabled) (Nothing to be done here)
This completes setting up a Scheduled Task in Windows by following the above 7 steps.
How to Test Scheduled Task is configured
In order to test your scheduled task is working as expected we will test with a batch file configured to run at a specified event/time which will output a text to another file. If the "Scheduled Task" ran at the scheduled time, the script will run at that time.
See below, the task has been specified to run at 7:32 PM
The screenshot below shows the task called as "first" has been configured to run at 7:32:05 PM.
The Action tab (below) specifies the script "run_echo.bat" that will be called when the event is triggered (at the configured time)
We will wait until the time configured as elapsed. After the specified time of trigger (7:32:05 PM) we will check the contents of the output file.
If the scheduled task ran at the defined time then we can check the output file (in this example being out_hello.txt). When the task is triggered or run at the configured/scheduled time, the batch file runs and the output is written into the text file. (The batch file/script will output text into the file called as out_hello.txt)
If the scheduled task ran at the defined time then we can check the output file (in this example being out_hello.txt). When the task is triggered or run at the configured/scheduled time, the batch file runs and the output is written into the text file. (The batch file/script will output text into the file called as out_hello.txt)
The batch file is shown below. (the batch file runs an echo command and outputs the current time to another file out_hello.txt)
And the output file contents are shown below
hello
07:32 PM
This test shows that the scheduled task ran successfully at 7:32 PM. You can also check the Task Scheduler which will show - "The operation completed successfully. (0x0)
Comments
Post a Comment