May 23, 2024

Run C Sharp Console Application using Windows Task Scheduler

Some tome we need to do a task periodically. Suppose we want to transfer file from one location to another location periodically. For this we can developed an windows service or console application. This article describes how to run an application in windows task scheduler. Summary of the article:

  • Creation of C# Console Application
  • Creation of Windows Task Scheduler

Creation of C# Console Application
At first we need to create a console application in C#. Write the desired code to fulfill the requirements. Then compile it. After compilation some dll or exe files will be generated in Bin folder. This dll or exe files will be used to make a Task in Windows Scheduler.

Creation of Windows Task Scheduler
The steps to create a windows task scheduler is given bellow:

Step 1
Log on as administrator.

Step 2
Make a folder or directory [ConFile] in the hard disc and copy all the dll or exe files of console application from Bin folder.

Step 3
Open Task Scheduler by either typing “task” on the Start Menu search bar, or by opening All Programs –> Accessories –> System Tools.
Two options are available to create windows task “Create Basic Task” and “Create Task..”. We can follow any one of them.Both are almost same [Create Task some some advance options].  Here we will follow “Create Basic Task”.

Windows Searching Window
Task Scheduler

Step 4
Select “Create Basic Task” from the right hand pane and the Create Basic Task Wizard will open.

Basic Task Wizard

Step 5
Type a “Name” and “Description” [ConFile] for the new task and click next.Basic Task Wizard

Step 6
Select when you would like the event/task to run and click next. Here we will select daily.Basic Task Wizard

Step 7
Select the exact time when you want to run the application and click next.Basic Task Wizard

Step 8
Select action and click next. Here we will select Start a program.Basic Task Wizard

Step 9
Click “Browse” and select the exe/dll file form the [ConFile] folder and click next.Basic Task Wizard

Step 10
Click Finish.

Basic Task Wizard

New the task has been created and will be run at the specified time. Click “Refresh” and new Task [ConFile]. This Task will perform according to the functionality of console application.
We can change our task settings at any time, just double-click the task name.
We can also delete the task just clicking the “Delete” button in the right hand pane.

In this way we can make any application automated. That’s all about windows task scheduler.

Rashedul Alam

I am a software engineer/architect, technology enthusiast, technology coach, blogger, travel photographer. I like to share my knowledge and technical stuff with others.

View all posts by Rashedul Alam →

Leave a Reply

Your email address will not be published. Required fields are marked *