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();
}

You don't want to just use the "scheduled tasks" that windows gives you?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.