I've created an executable file from a c# program, in which the main method returns an integer value - 0 for success and 1 for failure.
I have a Windows Task Scheduler task which runs this executable file. However, no matter what the main method returns, the Task Scheduler will always display "Success" for this task, simply because the console window closed.
I have also tried creating a batch file to run the executable, and having the Task Scheduler run the batch file instead. The batch file looks like this:
start /d "c:\filepath" file.exe
if %ERRORLEVEL% NEQ 0 echo %ERRORLEVEL%
Currently this seems to have no effect on the Task Scheduler. How can I get the Task Scheduler to show that the task failed?