How can a C# Windows Console application tell if it is run interactively
To determine if a .NET application is running in GUI mode:
bool is_console_app = Console.OpenStandardInput(1) != Stream.Null;
Environment.UserInteractive Property
I haven't tested it, but Environment.UserInteractive looks promising.