Thursday, November 14, 2024
HomeWindowsSchedule a C# Program Using Windows Task Scheduler

Schedule a C# Program Using Windows Task Scheduler

Windows Task Scheduler is a built-in Windows utility which schedules and runs tasks in the background. After you have developed your application, using Task Scheduler is a simple way to execute your application to do repeated tasks.

Configure a task in Task Scheduler with the appropriate action and condition, and Windows Task Scheduler will automatically run the task for you. Here, we will schedule one of the C# program we developed using Windows Task Scheduler.

1. First, search for Task Scheduler in Windows Search programs and files, and open it.

2. In the opened Task Scheduler window, navigate to the right side, and click on Create Task. You will get a pop-up window.

Specify the task Name and Description as per your requirements. Check all boxes marked in red
in the image below, if needed.


Note: Click on the image to view its original size.

3. Go to the Trigger tab, and click on New... Then set scheduled timings as per your requirements, and click OK.

In my case, I am scheduling a C# program to run daily at 3:30 PM.

4. Now, go to the Action tab. Here you need to select the executable path of your C# program.

Click on New… keep action as ‘Start a program’ and in Program/script, browse to your executable path of the C# program.

“C:\Users\dalvi\Documents\Visual Studio 2010\Projects\CPU_Usages\CPU_Usages\bin\Debug\CPU_Usages.exe”

In the Start in (optional) field, specify the path until the last folder, which you have specified in Program/script, without double quotes.

C:\Users\dalvi\Documents\Visual Studio 2010\Projects\CPU_Usages\CPU_Usages\bin\Debug\

Note: Do not put double quotes in the above Start in path. Otherwise, you will get an invalid directory error in Windows Task Scheduler.

5. Conditions, Settings are advanced settings that you can use if you need them.

6. Click on OK. You are all done. In the Task Scheduler Library window on the right side, you can see your scheduled tasks.

Vishwanath Dalvi
Vishwanath Dalvi
Vishwanath Dalvi is a gifted engineer and tech enthusiast. He enjoys music, magic, movies, and gaming. When not hacking around or supporting the open source community, he is trying to overcome his phobia of dogs.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

LATEST REVIEWS

Recent Comments

error: Content is protected !!