Question:

Do you know of any reasons why a Windows GUI program might run OK from the Windows command prompt but not when launched by JobScheduler? JobScheduler launches it and I can see it in Windows Task Manager, a short while later it exits and JobScheduler shows a normal end, without an error.

Answer:

There are (at least) two possible reasons for this behavior:

  • The program does not return a suitable exit code in case of errors or warnings (suitable means an exit code != 0). Therefore, the JobScheduler would not notice any errors. Additionally, errors would be noticed if they were reported to stderr by the respective program.
  • As you say that the program normally shows a GUI window - this might cause problems: JobScheduler executes programs in batch mode, i.e. without user interface as there is no user to answer input prompts. In order to verify this you could start the JobScheduler manually: stop JobScheduler Windows service and start it by the command .\bin\jobscheduler.cmd start in a separate console Window. Should the program be executed correctly then you could change the settings in the Windows service panel for the JobScheduler: the panel shows a tab for the credentials that might be assigned the system account. There you will find a check box that indicates if the service is allowed to interact with your desktop.