i am creating shedule task program ..
eg. daily ...
i want to create this program like
when pc restart or on...
i want this exe check this timing automatically and executes at that time
How to do this??

#include<stdio.h>
#include<conio.h>
#include<time.h>
#include<stdlib.h>
#include<ctype.h>
#include<dos.h>
#include<windows.h>

int main()
{
      int a,b,ch,hr,min,sec,day,i,j,k,dayweek,month;
      char str[10],am,pm,ans[2],c[2];
      SYSTEMTIME st, lt;
      
      printf("\nDaily Execution");
         
       GetLocalTime(&lt);
       printf(" The local time is: %02d:%02d:%02d\n", lt.wHour, lt.wMinute,lt.wSecond);
       printf("\n ENTER THE TIME @ EXE TO BE EXECUTED:->> ");
       scanf("%d:%d:%d",&hr,&min,&sec);
       printf("\nYOU HAVE ENTERED %d:%d:%d",hr,min,sec);
                                   
      while(1)
      {
              GetLocalTime(&lt);                 
             if(lt.wHour==hr && lt.wMinute==min && lt.wSecond==sec)
             {
                                    
                printf("\n");
                system("c://tp.exe");
                                          
              }
       }                         
      getch();
}

Information about Schtasks.exe in xp for creation schedule task ???

link or example to create schedule task through command prompt ???

I think you are overcomplicating it, just google scheduled tasks. You should able to create one easily using the tools provided by windows.

Just create your normal application and add it to the scheduled tasks. You don't need to worry much about (regarding the code) the scheduling part.

This article has been dead for over six months. Start a new discussion instead.