I made a simple c# .net console application. It's a backup script to copy a file to another folder and add the date to the the filename to keep it unique. The script runs perfectly.
However when I schedule it in Windows task scheduler, its status will stay on "running" after started while the application closed already.
I tried ending the main function with an int return value of 0 and I tried to have "System.Environment.Exit(0);" as last line of the application. I also removed all other code just leaving the exit code on to make sure the error was not in my code.
The checkbox "If the running task does not end when requested, force it to stop" is enabled.
All this didn't solve the problem.
I'm running windows server 2016
Anyone know how I can solve this problem?
EXIT? If not you could start your application with that batch file andEXITafterwards. Also hit the refresh button a few times before checking on the state, afaik it doesn't update automatically. - sknt