Guest_imported
New member
- Jan 1, 1970
- 0
I am trying to read the system time and run a batch file on a specific day and time. I wrote the following code using C++ help library.
SYSTEMTIME timeNow;
while(1)
{
Sleep(30000L); // check every 30 sec.
GetSystemTime(&timeNow);
// make sure its monday and its 10pm
if (timeNow.wDayOfWeek == 1 || timeNow.wHour == 22)
//need run bat file routine here
While(timeNow.WMinute == 0)
// dont run twice in the same hour
{
Sleep(60000L);
GetSystemTime(&timeNow);
}
}
I am not getting any result from this code can someone please help, Where am i going wrong.
SYSTEMTIME timeNow;
while(1)
{
Sleep(30000L); // check every 30 sec.
GetSystemTime(&timeNow);
// make sure its monday and its 10pm
if (timeNow.wDayOfWeek == 1 || timeNow.wHour == 22)
//need run bat file routine here
While(timeNow.WMinute == 0)
// dont run twice in the same hour
{
Sleep(60000L);
GetSystemTime(&timeNow);
}
}
I am not getting any result from this code can someone please help, Where am i going wrong.