0

How can I recognize, if .NET Framework 4.8 Console App was executed by user directly or by Windows Task Scheduler.

I tried to browse current process information, especially StartInfo property.

Unfortunately, I haven't found any interesting difference.

Any idea?

Tom
  • 19
  • 6
  • 2
    If your use case is trivial, perhaps you could pass an argument to it in the case that it's executed by the task scheduler? – DiplomacyNotWar Jan 12 '22 at 10:13
  • What have you tried, what didn't work and why is this *not* a duplicate of [How can a C# Windows Console application tell if it is run interactively](https://stackoverflow.com/questions/1188658/how-can-a-c-sharp-windows-console-application-tell-if-it-is-run-interactively)? The property `Environment.UserInteractive` would be enough in most cases - unless you explicitly specified that the scheduled task should use a desktop – Panagiotis Kanavos Jan 12 '22 at 10:19

0 Answers0