I have an application which needs to set a scheduled tasks in Windows. For this I have used the ShellExecute function to call the schtasks.exe
I have used the following code :
ShellExecute(NULL, _T("open"), _T("schtasks.exe"), _T("/create /TN SampleSchedule /TR calc.exe /SC DAILY /ST 12:15:00 /SD 09/04/2012"),_T(""),0);
but it has not created the scheduled task.
But when I changed the last parameter of ShellExecute function (display command prompt) to 1
ShellExecute(NULL, _T("open"), _T("schtasks.exe"), _T("/create /TN SampleSchedule /TR calc.exe /SC DAILY /ST 12:15:00 /SD 09/04/2012"),_T(""),1);
a command prompt displayed and it asked for the password of the current logged in user.
The /RU SYSTEM is working, but I would like to run as the current logged in user itself without asking for the password....
Is it possible? If yes, what should I do for that?