I have a program that executes another program and the main program continues when that program is finished.
Process p = Process.Start("program2.exe");
while (!p.HasExited)
Thread.Sleep(10000);
if (p.HasExited)
{
// Execute more code
}
This works great as when I run the program. But does not work when it is used as a scheduled task in windows. this part never executes
if (p.HasExited)
{
// Execute more code
}
Can't seem to find a way to debug this. I've been stuck on this program for a week now.